Skip to content

Commit 7814446

Browse files
committed
Patch for earlier Unity versions
1 parent 1aa13ba commit 7814446

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Editor/MissingScriptsFinder.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
//
1111
// **************************************************************** //
1212

13+
#if !UNITY_2020_OR_NEWER && !UNITY_2020_1_OR_NEWER
14+
using System.Linq;
15+
#endif
16+
1317
using UnityEditor;
1418
using UnityEngine;
1519
using UnityEditor.SceneManagement;
@@ -42,8 +46,17 @@ private static GameObject[] FindGameObjects(bool includeInactive = true)
4246
: FindObjectsInactive.Exclude;
4347

4448
return Object.FindObjectsByType<GameObject>(inactiveMode, FindObjectsSortMode.InstanceID);
45-
#else
49+
#elif UNITY_2020_OR_NEWER || UNITY_2020_1_OR_NEWER
4650
return Object.FindObjectsOfType<GameObject>(includeInactive);
51+
#else
52+
if (includeInactive)
53+
{
54+
return Resources.FindObjectsOfTypeAll<GameObject>().Cast<GameObject>().ToArray();
55+
}
56+
else
57+
{
58+
return Object.FindObjectsOfType<GameObject>();
59+
}
4760
#endif
4861
}
4962

0 commit comments

Comments
 (0)