com.wallstop-studios.unity-helpers 2.0.0-rc81 → 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
 
@@ -37,6 +41,7 @@ namespace WallstopStudios.UnityHelpers.Core.Extension
37
41
  private static void InitializeMainThread()
38
42
  {
39
43
  UnityMainThread = Thread.CurrentThread;
44
+ Disabled.Clear();
40
45
  }
41
46
 
42
47
  public static void GlobalEnableLogging(this Object component)
@@ -137,7 +142,7 @@ namespace WallstopStudios.UnityHelpers.Core.Extension
137
142
  #if ENABLE_UBERLOGGING || DEBUG_LOGGING
138
143
  if (LoggingAllowed(component))
139
144
  {
140
- if (Equals(Thread.CurrentThread, UnityMainThread))
145
+ if (ShouldLogOnMainThread)
141
146
  {
142
147
  LogInstance.Log(message, component, e, pretty);
143
148
  }
@@ -166,7 +171,7 @@ namespace WallstopStudios.UnityHelpers.Core.Extension
166
171
  #if ENABLE_UBERLOGGING || WARN_LOGGING
167
172
  if (LoggingAllowed(component))
168
173
  {
169
- if (Equals(Thread.CurrentThread, UnityMainThread))
174
+ if (ShouldLogOnMainThread)
170
175
  {
171
176
  LogInstance.LogWarn(message, component, e, pretty);
172
177
  }
@@ -195,7 +200,7 @@ namespace WallstopStudios.UnityHelpers.Core.Extension
195
200
  #if ENABLE_UBERLOGGING || ERROR_LOGGING
196
201
  if (LoggingAllowed(component))
197
202
  {
198
- if (Equals(Thread.CurrentThread, UnityMainThread))
203
+ if (ShouldLogOnMainThread)
199
204
  {
200
205
  LogInstance.LogError(message, component, e, pretty);
201
206
  }
@@ -37,6 +37,12 @@ namespace WallstopStudios.UnityHelpers.Utils
37
37
  [SerializeField]
38
38
  private GameObject[] _developmentOnlyPrefabs = Array.Empty<GameObject>();
39
39
 
40
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
41
+ private static void ClearSpawnedPrefabs()
42
+ {
43
+ SpawnedPrefabs.Clear();
44
+ }
45
+
40
46
  private void Awake()
41
47
  {
42
48
  if (_spawnMethod.HasFlagNoAlloc(ChildSpawnMethod.Awake))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc81",
3
+ "version": "2.0.0-rc81.2",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},
@@ -36,4 +36,3 @@
36
36
  "test": "echo \"Error: no test specified\" && exit 1"
37
37
  }
38
38
  }
39
-