diff --git a/Assets/VRM/Runtime/BlendShape/PreviewSceneManager.cs b/Assets/VRM/Runtime/BlendShape/PreviewSceneManager.cs index 843ff1291..e334356ac 100644 --- a/Assets/VRM/Runtime/BlendShape/PreviewSceneManager.cs +++ b/Assets/VRM/Runtime/BlendShape/PreviewSceneManager.cs @@ -25,7 +25,11 @@ namespace VRM PreviewSceneManager manager = null; // if we already instantiated a PreviewInstance previously but just lost the reference, then use that same instance instead of making a new one +#if UNITY_2022_3_OR_NEWER var managers = GameObject.FindObjectsByType(FindObjectsSortMode.InstanceID); +#else + var managers = GameObject.FindObjectsOfType(); +#endif foreach (var x in managers) { if (x.Prefab == prefab) diff --git a/Assets/VRM/Runtime/FirstPerson/VRMFirstPersonCameraManager.cs b/Assets/VRM/Runtime/FirstPerson/VRMFirstPersonCameraManager.cs index 8126111ef..21817a5af 100644 --- a/Assets/VRM/Runtime/FirstPerson/VRMFirstPersonCameraManager.cs +++ b/Assets/VRM/Runtime/FirstPerson/VRMFirstPersonCameraManager.cs @@ -57,7 +57,11 @@ namespace VRM void Reset() { +#if UNITY_2022_3_OR_NEWER var cameras = GameObject.FindObjectsByType(FindObjectsSortMode.InstanceID); +#else + var cameras = GameObject.FindObjectsOfType(); +#endif m_firstPersonCamera = Camera.main; m_thirdPersonCameras = cameras.Where(x => x != m_firstPersonCamera).ToArray(); } diff --git a/Assets/VRM/Runtime/LookAt/LookAtTargetSwitcher.cs b/Assets/VRM/Runtime/LookAt/LookAtTargetSwitcher.cs index f7c99ec3e..8f4812f76 100644 --- a/Assets/VRM/Runtime/LookAt/LookAtTargetSwitcher.cs +++ b/Assets/VRM/Runtime/LookAt/LookAtTargetSwitcher.cs @@ -20,8 +20,13 @@ namespace VRM private void Reset() { +#if UNITY_2022_3_OR_NEWER m_lookAtHead = GameObject.FindFirstObjectByType(); m_blinker = GameObject.FindFirstObjectByType(); +#else + m_lookAtHead = GameObject.FindObjectOfType(); + m_blinker = GameObject.FindObjectOfType(); +#endif } float CalcScore(Transform target) diff --git a/Assets/VRM10/Runtime/Components/Expression/Preview/PreviewSceneManager.cs b/Assets/VRM10/Runtime/Components/Expression/Preview/PreviewSceneManager.cs index 3a9c8d836..418d0eebe 100644 --- a/Assets/VRM10/Runtime/Components/Expression/Preview/PreviewSceneManager.cs +++ b/Assets/VRM10/Runtime/Components/Expression/Preview/PreviewSceneManager.cs @@ -27,7 +27,11 @@ namespace UniVRM10 PreviewSceneManager manager = null; // if we already instantiated a PreviewInstance previously but just lost the reference, then use that same instance instead of making a new one +#if UNITY_2022_3_OR_NEWER var managers = GameObject.FindObjectsByType(FindObjectsSortMode.InstanceID); +#else + var managers = GameObject.FindObjectsOfType(); +#endif foreach (var x in managers) { if (x.Prefab == prefab) diff --git a/Assets/VRM10/Runtime/FastSpringBone/System/FastSpringBoneService.cs b/Assets/VRM10/Runtime/FastSpringBone/System/FastSpringBoneService.cs index da1e52f28..aef3a652f 100644 --- a/Assets/VRM10/Runtime/FastSpringBone/System/FastSpringBoneService.cs +++ b/Assets/VRM10/Runtime/FastSpringBone/System/FastSpringBoneService.cs @@ -49,7 +49,11 @@ namespace UniVRM10.FastSpringBones.System { if (_instance) return _instance; +#if UNITY_2022_3_OR_NEWER _instance = FindFirstObjectByType(); +#else + _instance = FindObjectOfType(); +#endif if (_instance) return _instance; var gameObject = new GameObject("FastSpringBone Service"); diff --git a/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10CanvasManager.cs b/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10CanvasManager.cs index 6e01fd11e..09fae2b50 100644 --- a/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10CanvasManager.cs +++ b/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10CanvasManager.cs @@ -15,8 +15,13 @@ namespace UniVRM10.FirstPersonSample private void Reset() { +#if UNITY_2022_3_OR_NEWER LoadVRMButton = GameObject.FindObjectsByType