diff --git a/Assets/External/AstarPathfindingProject/Core/AI/AIBase.cs b/Assets/External/AstarPathfindingProject/Core/AI/AIBase.cs index c9d3adc4..e02d81b0 100644 --- a/Assets/External/AstarPathfindingProject/Core/AI/AIBase.cs +++ b/Assets/External/AstarPathfindingProject/Core/AI/AIBase.cs @@ -425,7 +425,7 @@ namespace Pathfinding { // If gravity is used depends on a lot of things. // For example when a non-kinematic rigidbody is used then the rigidbody will apply the gravity itself // Note that the gravity can contain NaN's, which is why the comparison uses !(a==b) instead of just a!=b. - usingGravity = !(gravity == Vector3.zero) && (!updatePosition || ((rigid == null || rigid.isKinematic) && (rigid2D == null || rigid2D.isKinematic))); + usingGravity = !(gravity == Vector3.zero) && (!updatePosition || ((rigid == null || rigid.isKinematic) && (rigid2D == null || rigid2D.bodyType == RigidbodyType2D.Kinematic))); if (rigid == null && rigid2D == null && canMove) { Vector3 nextPosition; Quaternion nextRotation; diff --git a/Assets/External/AstarPathfindingProject/Core/AstarPath.cs b/Assets/External/AstarPathfindingProject/Core/AstarPath.cs index 029dc5b1..a1eb673b 100644 --- a/Assets/External/AstarPathfindingProject/Core/AstarPath.cs +++ b/Assets/External/AstarPathfindingProject/Core/AstarPath.cs @@ -677,7 +677,7 @@ public class AstarPath : VersionedMonoBehaviour { /// public static void FindAstarPath () { if (Application.isPlaying) return; - if (active == null) active = GameObject.FindObjectOfType(); + if (active == null) active = FindFirstObjectByType(); if (active != null && (active.data.graphs == null || active.data.graphs.Length == 0)) active.data.DeserializeGraphs(); } @@ -1222,7 +1222,7 @@ public class AstarPath : VersionedMonoBehaviour { // Very important to set this. Ensures the singleton pattern holds active = this; - if (FindObjectsOfType(typeof(AstarPath)).Length > 1) { + if (FindObjectsByType(FindObjectsSortMode.None).Length > 1) { Debug.LogError("You should NOT have more than one AstarPath component in the scene at any time.\n" + "This can cause serious errors since the AstarPath component builds around a singleton pattern."); } diff --git a/Assets/External/AstarPathfindingProject/Core/Misc/GraphModifier.cs b/Assets/External/AstarPathfindingProject/Core/Misc/GraphModifier.cs index ca8af4ad..d3c735f3 100644 --- a/Assets/External/AstarPathfindingProject/Core/Misc/GraphModifier.cs +++ b/Assets/External/AstarPathfindingProject/Core/Misc/GraphModifier.cs @@ -39,7 +39,7 @@ namespace Pathfinding { } public static void FindAllModifiers () { - var allModifiers = FindObjectsOfType(typeof(GraphModifier)) as GraphModifier[]; + var allModifiers = FindObjectsByType(FindObjectsSortMode.None) as GraphModifier[]; for (int i = 0; i < allModifiers.Length; i++) { if (allModifiers[i].enabled) allModifiers[i].OnEnable(); diff --git a/Assets/External/AstarPathfindingProject/Core/Serialization/JsonSerializer.cs b/Assets/External/AstarPathfindingProject/Core/Serialization/JsonSerializer.cs index b1424c8a..8308a7a0 100644 --- a/Assets/External/AstarPathfindingProject/Core/Serialization/JsonSerializer.cs +++ b/Assets/External/AstarPathfindingProject/Core/Serialization/JsonSerializer.cs @@ -127,7 +127,7 @@ namespace Pathfinding.Serialization { } if (!string.IsNullOrEmpty(guid)) { - UnityReferenceHelper[] helpers = UnityEngine.Object.FindObjectsOfType(typeof(UnityReferenceHelper)) as UnityReferenceHelper[]; + UnityReferenceHelper[] helpers = UnityEngine.Object.FindObjectsByType(FindObjectsSortMode.None) as UnityReferenceHelper[]; for (int i = 0; i < helpers.Length; i++) { if (helpers[i].GetGUID() == guid) { diff --git a/Assets/External/AstarPathfindingProject/Core/Serialization/TinyJson.cs b/Assets/External/AstarPathfindingProject/Core/Serialization/TinyJson.cs index d3d07aae..25814cc6 100644 --- a/Assets/External/AstarPathfindingProject/Core/Serialization/TinyJson.cs +++ b/Assets/External/AstarPathfindingProject/Core/Serialization/TinyJson.cs @@ -341,7 +341,7 @@ namespace Pathfinding.Serialization { } #if UNITY_2020_1_OR_NEWER - foreach (var helper in UnityEngine.Object.FindObjectsOfType(true)) + foreach (var helper in UnityEngine.Object.FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None)) #else foreach (var helper in UnityEngine.Object.FindObjectsOfType()) #endif diff --git a/Assets/External/AstarPathfindingProject/ExampleScenes/ExampleScripts/TargetMover.cs b/Assets/External/AstarPathfindingProject/ExampleScenes/ExampleScripts/TargetMover.cs index e28ba7ca..e9314e29 100644 --- a/Assets/External/AstarPathfindingProject/ExampleScenes/ExampleScripts/TargetMover.cs +++ b/Assets/External/AstarPathfindingProject/ExampleScenes/ExampleScripts/TargetMover.cs @@ -29,7 +29,7 @@ namespace Pathfinding { cam = Camera.main; // Slightly inefficient way of finding all AIs, but this is just an example script, so it doesn't matter much. // FindObjectsOfType does not support interfaces unfortunately. - ais = FindObjectsOfType().OfType().ToArray(); + ais = FindObjectsByType(FindObjectsSortMode.None).OfType().ToArray(); useGUILayout = false; } diff --git a/Assets/External/AstarPathfindingProject/Navmesh/RelevantGraphSurface.cs b/Assets/External/AstarPathfindingProject/Navmesh/RelevantGraphSurface.cs index 425a0b1c..0f72bd8e 100644 --- a/Assets/External/AstarPathfindingProject/Navmesh/RelevantGraphSurface.cs +++ b/Assets/External/AstarPathfindingProject/Navmesh/RelevantGraphSurface.cs @@ -73,7 +73,7 @@ namespace Pathfinding { } public static void FindAllGraphSurfaces () { - var srf = GameObject.FindObjectsOfType(typeof(RelevantGraphSurface)) as RelevantGraphSurface[]; + var srf = GameObject.FindObjectsByType(FindObjectsSortMode.None) as RelevantGraphSurface[]; for (int i = 0; i < srf.Length; i++) { srf[i].OnDisable(); diff --git a/Assets/External/AstarPathfindingProject/Utilities/UnityReferenceHelper.cs b/Assets/External/AstarPathfindingProject/Utilities/UnityReferenceHelper.cs index 53c18660..f46f7a04 100644 --- a/Assets/External/AstarPathfindingProject/Utilities/UnityReferenceHelper.cs +++ b/Assets/External/AstarPathfindingProject/Utilities/UnityReferenceHelper.cs @@ -27,7 +27,7 @@ namespace Pathfinding { } else if (gameObject.scene.name != null) { // Create a new GUID if there are duplicates in the scene. // Don't do this if this is a prefab (scene.name == null) - foreach (UnityReferenceHelper urh in FindObjectsOfType(typeof(UnityReferenceHelper)) as UnityReferenceHelper[]) { + foreach (UnityReferenceHelper urh in FindObjectsByType(FindObjectsSortMode.None) as UnityReferenceHelper[]) { if (urh != this && guid == urh.guid) { guid = Pathfinding.Util.Guid.NewGuid().ToString(); Debug.Log("Created new GUID - " + guid, this);