@@ -163,12 +163,33 @@ public void SetTimeTimeScale(float timeScale)
163
163
Debug . Log ( $ "Time.timeScale: { Time . timeScale } ") ;
164
164
}
165
165
166
+ /// <summary>
167
+ /// Log information about when the WebBridge was initialized
168
+ /// </summary>
169
+ [ WebCommand ( Description = "Log initialization time information" ) ]
170
+ [ ContextMenu ( nameof ( LogInitializationTime ) ) ]
171
+ public void LogInitializationTime ( )
172
+ {
173
+ var currentUnityTime = Time . realtimeSinceStartupAsDouble ;
174
+ var currentUtcTime = DateTime . UtcNow ;
175
+
176
+ var unityTimeSinceInit = currentUnityTime - WebBridge . InitializationUnityTime ;
177
+ var utcTimeSinceInit = currentUtcTime - WebBridge . InitializationUtcTime ;
178
+
179
+ var timeComparison = unityTimeSinceInit > utcTimeSinceInit . TotalSeconds
180
+ ? "future"
181
+ : "past" ;
182
+
183
+ Debug . Log ( $ "Unity Time since init: { unityTimeSinceInit : F2} s\n " +
184
+ $ "UTC Time since init: { utcTimeSinceInit . TotalSeconds : F2} s\n " +
185
+ $ "Unity time lies { Math . Abs ( unityTimeSinceInit - utcTimeSinceInit . TotalSeconds ) : F2} s in the { timeComparison } compared to UTC") ;
186
+ }
187
+
166
188
/// <summary>
167
189
/// Finds GameObject(s) by name and logs the found GameObject(s) and their components
168
190
/// </summary>
169
191
/// <param name="name">The name of the GameObject to find</param>
170
192
[ WebCommand ( Description = "Find GameObject by name and log its components" ) ]
171
- [ ContextMenu ( nameof ( FindGameObjectByName ) ) ]
172
193
public void FindGameObjectByName ( string name )
173
194
{
174
195
var gameObjects = GameObject . FindObjectsOfType < GameObject > ( ) . Where ( go => go . name == name ) . ToArray ( ) ;
@@ -312,7 +333,6 @@ public void DeleteAllPlayerPrefs()
312
333
/// </summary>
313
334
/// <param name="runInBackground">1 if it should run in background</param>
314
335
[ WebCommand ( Description = "GraphicsSettings.logWhenShaderIsCompiled" ) ]
315
- [ ContextMenu ( nameof ( LogShaderCompilation ) ) ]
316
336
public void LogShaderCompilation ( int enabled )
317
337
{
318
338
GraphicsSettings . logWhenShaderIsCompiled = enabled == 1 ;
0 commit comments