com.wallstop-studios.unity-helpers 2.0.0-rc81.1 → 2.0.0-rc81.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,10 @@ namespace WallstopStudios.UnityHelpers.Core.Extension
21
21
  createDefaultDecorators: true
22
22
  );
23
23
 
24
+ private static bool ShouldLogOnMainThread =>
25
+ Equals(Thread.CurrentThread, UnityMainThread)
26
+ || (UnityMainThread == null && !Application.isPlaying);
27
+
24
28
  private static Thread UnityMainThread;
25
29
  private const int LogsPerCacheClean = 5;
26
30
 
@@ -138,7 +142,7 @@ namespace WallstopStudios.UnityHelpers.Core.Extension
138
142
  #if ENABLE_UBERLOGGING || DEBUG_LOGGING
139
143
  if (LoggingAllowed(component))
140
144
  {
141
- if (Equals(Thread.CurrentThread, UnityMainThread))
145
+ if (ShouldLogOnMainThread)
142
146
  {
143
147
  LogInstance.Log(message, component, e, pretty);
144
148
  }
@@ -167,7 +171,7 @@ namespace WallstopStudios.UnityHelpers.Core.Extension
167
171
  #if ENABLE_UBERLOGGING || WARN_LOGGING
168
172
  if (LoggingAllowed(component))
169
173
  {
170
- if (Equals(Thread.CurrentThread, UnityMainThread))
174
+ if (ShouldLogOnMainThread)
171
175
  {
172
176
  LogInstance.LogWarn(message, component, e, pretty);
173
177
  }
@@ -196,7 +200,7 @@ namespace WallstopStudios.UnityHelpers.Core.Extension
196
200
  #if ENABLE_UBERLOGGING || ERROR_LOGGING
197
201
  if (LoggingAllowed(component))
198
202
  {
199
- if (Equals(Thread.CurrentThread, UnityMainThread))
203
+ if (ShouldLogOnMainThread)
200
204
  {
201
205
  LogInstance.LogError(message, component, e, pretty);
202
206
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc81.1",
3
+ "version": "2.0.0-rc81.2",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},