diff --git a/Assets/VRM10/Runtime/FastSpringBone/System/FastSpringBoneService.cs b/Assets/VRM10/Runtime/FastSpringBone/System/FastSpringBoneService.cs index e4df6e851..d3e103977 100644 --- a/Assets/VRM10/Runtime/FastSpringBone/System/FastSpringBoneService.cs +++ b/Assets/VRM10/Runtime/FastSpringBone/System/FastSpringBoneService.cs @@ -16,6 +16,9 @@ namespace UniVRM10.FastSpringBones.System { if (_instance) return _instance; + _instance = FindObjectOfType(); + if (_instance) return _instance; + var gameObject = new GameObject("FastSpringBone Service"); DontDestroyOnLoad(gameObject); _instance = gameObject.AddComponent(); @@ -33,14 +36,15 @@ namespace UniVRM10.FastSpringBones.System _instance = null; } - private void Awake() + private void OnEnable() { BufferCombiner = new FastSpringBoneBufferCombiner(); _fastSpringBoneScheduler = new FastSpringBoneScheduler(BufferCombiner); } - private void OnDestroy() + private void OnDisable() { + BufferCombiner.Dispose(); _fastSpringBoneScheduler.Dispose(); }