@@ -50,10 +50,11 @@ public static class WebToolPlugins
5050 /// <param name="value">Value of the variable</param>
5151 public static void SetVariable ( string variableName , string value )
5252 {
53- #if UNITY_WEBGL && ! UNITY_EDITOR
53+ #if UNITY_WEBGL && ! UNITY_EDITOR
5454 _SetStringVariable ( variableName , value ) ;
55- #endif
55+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
5656 Debug . Log ( $ "<color=#00CCCC>{ nameof ( WebToolPlugins ) } .{ nameof ( SetVariable ) } set { variableName } : { value } </color>") ;
57+ #endif
5758 }
5859
5960 /// <summary>
@@ -63,20 +64,20 @@ public static void SetVariable(string variableName, string value)
6364 /// <param name="eventName">Name of the tracking event, e.g. "Awake"</param>
6465 public static void AddTimeTrackingEvent ( string eventName )
6566 {
66- #if UNITY_WEBGL && ! UNITY_EDITOR
67+ #if UNITY_WEBGL && ! UNITY_EDITOR
6768 _AddTimeTrackingEvent ( eventName ) ;
68- #else
69+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
6970 Debug . Log ( $ "{ nameof ( WebToolPlugins ) } .{ nameof ( AddTimeTrackingEvent ) } called with { eventName } ") ;
70- #endif
71+ #endif
7172 }
7273
7374 public static void AddFpsTrackingEvent ( float fps )
7475 {
75- #if UNITY_WEBGL && ! UNITY_EDITOR
76+ #if UNITY_WEBGL && ! UNITY_EDITOR
7677 _AddFpsTrackingEvent ( fps ) ;
77- #else
78+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
7879 Debug . Log ( $ "{ nameof ( WebToolPlugins ) } .{ nameof ( AddFpsTrackingEvent ) } called with { fps : 0.00} ") ;
79- #endif
80+ #endif
8081 }
8182
8283 /// <summary>
@@ -87,11 +88,11 @@ public static void AddFpsTrackingEvent(float fps)
8788 public static void ShowInfoPanel ( )
8889 {
8990 _infoPanelVisible = true ;
90- #if UNITY_WEBGL && ! UNITY_EDITOR
91+ #if UNITY_WEBGL && ! UNITY_EDITOR
9192 _ShowInfoPanel ( ) ;
92- #else
93+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
9394 Debug . Log ( $ "{ nameof ( WebToolPlugins ) } .{ nameof ( ShowInfoPanel ) } called") ;
94- #endif
95+ #endif
9596 }
9697
9798 /// <summary>
@@ -102,11 +103,11 @@ public static void ShowInfoPanel()
102103 public static void HideInfoPanel ( )
103104 {
104105 _infoPanelVisible = false ;
105- #if UNITY_WEBGL && ! UNITY_EDITOR
106+ #if UNITY_WEBGL && ! UNITY_EDITOR
106107 _HideInfoPanel ( ) ;
107- #else
108+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
108109 Debug . Log ( $ "{ nameof ( WebToolPlugins ) } .{ nameof ( HideInfoPanel ) } called") ;
109- #endif
110+ #endif
110111 }
111112
112113 /// <summary>
@@ -130,12 +131,14 @@ public static void ToggleInfoPanel()
130131 /// <returns>navigator.userAgent</returns>
131132 public static string GetUserAgent ( )
132133 {
133- #if UNITY_WEBGL && ! UNITY_EDITOR
134+ #if UNITY_WEBGL && ! UNITY_EDITOR
134135 return _GetUserAgent ( ) ;
135- #else
136+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
136137 Debug . Log ( $ "{ nameof ( WebToolPlugins ) } .{ nameof ( GetUserAgent ) } called") ;
137138 return "undefined" ;
138- #endif
139+ #else
140+ return "undefined" ;
141+ #endif
139142 }
140143
141144 /// <summary>
@@ -157,13 +160,15 @@ public static bool IsMobileDevice()
157160 /// <returns>Size in MB</returns>
158161 public static float GetTotalMemorySize ( )
159162 {
160- #if UNITY_WEBGL && ! UNITY_EDITOR
163+ #if UNITY_WEBGL && ! UNITY_EDITOR
161164 var bytes = _GetTotalMemorySize ( ) ;
162165 return GetMegaBytes ( bytes ) ;
163- #else
166+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
164167 Debug . Log ( $ "{ nameof ( WebToolPlugins ) } .{ nameof ( GetTotalMemorySize ) } called") ;
165168 return - 1f ;
166- #endif
169+ #else
170+ return - 1f ;
171+ #endif
167172 }
168173
169174 /// <summary>
@@ -176,7 +181,7 @@ public static void LogMemory()
176181 var native = GetNativeMemorySize ( ) ;
177182 var total = GetTotalMemorySize ( ) ;
178183 Debug . Log ( $ "Memory stats:\n Managed: { managed : 0.00} MB\n Native: { native : 0.00} MB\n Total: { total : 0.00} MB") ;
179- #else
184+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
180185 Debug . Log ( $ "{ nameof ( WebToolPlugins ) } .{ nameof ( LogMemory ) } called") ;
181186#endif
182187 }
@@ -187,13 +192,15 @@ public static void LogMemory()
187192 /// <returns>Size in MB</returns>
188193 public static float GetStaticMemorySize ( )
189194 {
190- #if UNITY_WEBGL && ! UNITY_EDITOR
195+ #if UNITY_WEBGL && ! UNITY_EDITOR
191196 var bytes = _GetStaticMemorySize ( ) ;
192197 return GetMegaBytes ( bytes ) ;
193- #else
198+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
194199 Debug . Log ( $ "{ nameof ( WebToolPlugins ) } .{ nameof ( GetStaticMemorySize ) } called") ;
195200 return - 1f ;
196- #endif
201+ #else
202+ return - 1f ;
203+ #endif
197204 }
198205
199206 /// <summary>
@@ -202,13 +209,15 @@ public static float GetStaticMemorySize()
202209 /// <returns>Size in MB</returns>
203210 public static float GetDynamicMemorySize ( )
204211 {
205- #if UNITY_WEBGL && ! UNITY_EDITOR
212+ #if UNITY_WEBGL && ! UNITY_EDITOR
206213 var bytes = _GetStaticMemorySize ( ) ;
207214 return GetMegaBytes ( bytes ) ;
208- #else
215+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
209216 Debug . Log ( $ "{ nameof ( WebToolPlugins ) } .{ nameof ( GetDynamicMemorySize ) } called") ;
210217 return - 1f ;
211- #endif
218+ #else
219+ return - 1f ;
220+ #endif
212221 }
213222
214223 /// <summary>
@@ -217,12 +226,14 @@ public static float GetDynamicMemorySize()
217226 /// <returns>Size in MB</returns>
218227 public static float GetNativeMemorySize ( )
219228 {
220- #if UNITY_WEBGL && ! UNITY_EDITOR
229+ #if UNITY_WEBGL && ! UNITY_EDITOR
221230 return GetDynamicMemorySize ( ) + GetStaticMemorySize ( ) ;
222- #else
231+ #elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
223232 Debug . Log ( $ "{ nameof ( WebToolPlugins ) } .{ nameof ( GetNativeMemorySize ) } called") ;
224233 return - 1f ;
225- #endif
234+ #else
235+ return - 1f ;
236+ #endif
226237 }
227238
228239 /// <summary>
@@ -231,7 +242,7 @@ public static float GetNativeMemorySize()
231242 /// <returns>Size in MB</returns>
232243 public static float GetManagedMemorySize ( )
233244 {
234- var bytes = ( uint ) GC . GetTotalMemory ( false ) ;
245+ var bytes = ( uint ) GC . GetTotalMemory ( false ) ;
235246 return GetMegaBytes ( bytes ) ;
236247 }
237248
@@ -242,7 +253,7 @@ public static float GetManagedMemorySize()
242253 /// <returns>bytes / (1024 * 1024)</returns>
243254 private static float GetMegaBytes ( uint bytes )
244255 {
245- return ( float ) bytes / ( 1024 * 1024 ) ;
256+ return ( float ) bytes / ( 1024 * 1024 ) ;
246257 }
247258 }
248259}
0 commit comments