@@ -163,12 +163,33 @@ public void SetTimeTimeScale(float timeScale)
163163 Debug . Log ( $ "Time.timeScale: { Time . timeScale } ") ;
164164 }
165165
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+
166188 /// <summary>
167189 /// Finds GameObject(s) by name and logs the found GameObject(s) and their components
168190 /// </summary>
169191 /// <param name="name">The name of the GameObject to find</param>
170192 [ WebCommand ( Description = "Find GameObject by name and log its components" ) ]
171- [ ContextMenu ( nameof ( FindGameObjectByName ) ) ]
172193 public void FindGameObjectByName ( string name )
173194 {
174195 var gameObjects = GameObject . FindObjectsOfType < GameObject > ( ) . Where ( go => go . name == name ) . ToArray ( ) ;
@@ -312,7 +333,6 @@ public void DeleteAllPlayerPrefs()
312333 /// </summary>
313334 /// <param name="runInBackground">1 if it should run in background</param>
314335 [ WebCommand ( Description = "GraphicsSettings.logWhenShaderIsCompiled" ) ]
315- [ ContextMenu ( nameof ( LogShaderCompilation ) ) ]
316336 public void LogShaderCompilation ( int enabled )
317337 {
318338 GraphicsSettings . logWhenShaderIsCompiled = enabled == 1 ;
0 commit comments