diff --git a/Assets/VRM/Runtime/IO/VrmGeometryBackup.cs b/Assets/VRM/Runtime/IO/VrmGeometryBackup.cs index a1d62feba..f7b79fcb3 100644 --- a/Assets/VRM/Runtime/IO/VrmGeometryBackup.cs +++ b/Assets/VRM/Runtime/IO/VrmGeometryBackup.cs @@ -72,8 +72,12 @@ namespace VRM { _springBoneColliders = root.GetComponentsInChildren().ToDictionary(x => x, x => new VrmSpringBoneColliderBackup(x)); _springBones = root.GetComponentsInChildren().ToDictionary(x => x, x => new VrmSpringBoneBackup(x)); + _firstPerson = root.GetComponent(); - _firstPersonOffsetInWorld = _firstPerson.transform.TransformPoint(_firstPerson.FirstPersonOffset); + if (_firstPerson != null) + { + _firstPersonOffsetInWorld = _firstPerson.transform.TransformPoint(_firstPerson.FirstPersonOffset); + } } public void Dispose() @@ -86,7 +90,11 @@ namespace VRM { v.Restore(k); } - _firstPerson.FirstPersonOffset = _firstPerson.transform.worldToLocalMatrix.MultiplyPoint(_firstPersonOffsetInWorld); + + if (_firstPerson != null) + { + _firstPerson.FirstPersonOffset = _firstPerson.transform.worldToLocalMatrix.MultiplyPoint(_firstPersonOffsetInWorld); + } } } } \ No newline at end of file