Skip to content

Commit 5b1ce9f

Browse files
committed
Fix findobjects complaints
1 parent 0de5222 commit 5b1ce9f

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

com.unity.netcode.gameobjects/Runtime/Core/FindObjects.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
#if NGO_FINDOBJECTS_NOSORTING
2-
using System;
3-
#endif
41
using System;
52
using System.Collections;
63
using System.Collections.Generic;
74
using System.Runtime.CompilerServices;
8-
using UnityEngine;
95
using UnityEngine.SceneManagement;
106
using Object = UnityEngine.Object;
117

@@ -16,7 +12,7 @@ namespace Unity.Netcode
1612
/// </summary>
1713
/// <remarks>
1814
/// It is intentional that we do not include the UnityEngine namespace in order to avoid
19-
/// over-complicatd define wrapping between versions that do or don't support FindObjectsSortMode.
15+
/// over-complicated define wrapping between versions that do or don't support FindObjectsSortMode.
2016
/// </remarks>
2117
internal static class FindObjects
2218
{
@@ -30,7 +26,7 @@ internal static class FindObjects
3026
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3127
public static T[] ByType<T>(bool includeInactive = false, bool orderByIdentifier = false) where T : Object
3228
{
33-
var inactive = includeInactive ? FindObjectsInactive.Include : FindObjectsInactive.Exclude;
29+
var inactive = includeInactive ? UnityEngine.FindObjectsInactive.Include : UnityEngine.FindObjectsInactive.Exclude;
3430
#if NGO_FINDOBJECTS_NOSORTING
3531
var results = Object.FindObjectsByType<T>(inactive);
3632
#if !NGO_FINDOBJECTS_UNORDERED_IDS
@@ -40,7 +36,7 @@ public static T[] ByType<T>(bool includeInactive = false, bool orderByIdentifier
4036
}
4137
#endif
4238
#else
43-
var results = Object.FindObjectsByType<T>(inactive, orderByIdentifier ? FindObjectsSortMode.InstanceID : FindObjectsSortMode.None);
39+
var results = Object.FindObjectsByType<T>(inactive, orderByIdentifier ? UnityEngine.FindObjectsSortMode.InstanceID : UnityEngine.FindObjectsSortMode.None);
4440
#endif
4541
return results;
4642
}
@@ -52,7 +48,7 @@ public static T[] ByType<T>(bool includeInactive = false, bool orderByIdentifier
5248
/// <param name="includeInactive">When true, inactive objects will be included.</param>
5349
/// <typeparam name="T">Type of <see cref="Component"/> to get from the scene</typeparam>
5450
/// <returns>a generator that yields successive NetworkObjects in the current scene</returns>
55-
public static IEnumerable<T> FromSceneByType<T>(Scene scene, bool includeInactive) where T : Component
51+
public static IEnumerable<T> FromSceneByType<T>(Scene scene, bool includeInactive) where T : UnityEngine.Component
5652
{
5753
return new ObjectsInSceneEnumerator<T>(scene, includeInactive);
5854
}
@@ -61,9 +57,9 @@ public static IEnumerable<T> FromSceneByType<T>(Scene scene, bool includeInactiv
6157
/// An Enumerator that enumerates over each component of type <see cref="T"/> in the given scene.
6258
/// </summary>
6359
/// <typeparam name="T">Type of <see cref="Component"/> to get from the scene</typeparam>
64-
private struct ObjectsInSceneEnumerator<T> : IEnumerable<T>, IEnumerator<T> where T : Component
60+
private struct ObjectsInSceneEnumerator<T> : IEnumerable<T>, IEnumerator<T> where T : UnityEngine.Component
6561
{
66-
private readonly GameObject[] m_RootObjects;
62+
private readonly UnityEngine.GameObject[] m_RootObjects;
6763
private int m_RootIndex;
6864
private T[] m_CurrentChildObjects;
6965
private int m_CurrentChildIndex;

0 commit comments

Comments
 (0)