com.wallstop-studios.unity-helpers 2.0.0-rc80.3 → 2.0.0-rc80.4

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.
@@ -56,7 +56,7 @@ namespace WallstopStudios.UnityHelpers.Core.Helper
56
56
  {
57
57
  if (ObjectsByTag.TryGetValue(tag, out Object value))
58
58
  {
59
- if (value != null && value is T typed)
59
+ if (value is T typed && typed != null)
60
60
  {
61
61
  return typed;
62
62
  }
@@ -166,7 +166,7 @@ namespace WallstopStudios.UnityHelpers.Core.Helper
166
166
  for (int i = 0; i < transform.childCount; ++i)
167
167
  {
168
168
  Transform child = transform.GetChild(i);
169
- EnableRecursively<T>(child, enabled, exclude);
169
+ EnableRecursively(child, enabled, exclude);
170
170
  }
171
171
  }
172
172
 
@@ -188,10 +188,14 @@ namespace WallstopStudios.UnityHelpers.Core.Helper
188
188
  behavior.enabled = enabled;
189
189
  }
190
190
 
191
- Transform transform = component as Transform ?? component.transform;
191
+ Transform transform = component as Transform;
192
192
  if (transform == null)
193
193
  {
194
- return;
194
+ transform = component.transform;
195
+ if (transform == null)
196
+ {
197
+ return;
198
+ }
195
199
  }
196
200
 
197
201
  for (int i = 0; i < transform.childCount; ++i)
@@ -280,7 +284,7 @@ namespace WallstopStudios.UnityHelpers.Core.Helper
280
284
  }
281
285
 
282
286
  public static void DestroyAllChildrenGameObjectsImmediately(this GameObject gameObject) =>
283
- InternalDestroyAllChildrenGameObjects(gameObject, Object.DestroyImmediate);
287
+ InternalDestroyAllChildrenGameObjects(gameObject, go => Object.DestroyImmediate(go));
284
288
 
285
289
  public static void PlayDestroyAllChildrenGameObjects(this GameObject gameObject) =>
286
290
  InternalDestroyAllChildrenGameObjects(gameObject, go => go.Destroy());
@@ -301,9 +305,17 @@ namespace WallstopStudios.UnityHelpers.Core.Helper
301
305
 
302
306
  public static bool IsPrefab(this GameObject gameObject)
303
307
  {
308
+ if (gameObject == null)
309
+ {
310
+ return false;
311
+ }
312
+
304
313
  Scene scene = gameObject.scene;
305
314
  #if UNITY_EDITOR
306
- if (scene.rootCount == 1 && string.Equals(scene.name, gameObject.name))
315
+ if (
316
+ scene.rootCount == 1
317
+ && string.Equals(scene.name, gameObject.name, StringComparison.Ordinal)
318
+ )
307
319
  {
308
320
  return true;
309
321
  }
@@ -321,6 +333,11 @@ namespace WallstopStudios.UnityHelpers.Core.Helper
321
333
 
322
334
  public static bool IsPrefab(this Component component)
323
335
  {
336
+ if (component == null)
337
+ {
338
+ return false;
339
+ }
340
+
324
341
  return IsPrefab(component.gameObject);
325
342
  }
326
343
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc80.3",
3
+ "version": "2.0.0-rc80.4",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},
@@ -55,5 +55,6 @@
55
55
 
56
56
 
57
57
 
58
+
58
59
 
59
60