From 491cb97fb111316553eef58a01d70a281e19b46d Mon Sep 17 00:00:00 2001 From: bd_ Date: Mon, 9 Oct 2023 18:59:50 +0900 Subject: [PATCH] fix: null reference errors when apply on play triggers late (#490) When an avatar is enabled after the scene is initially loaded, Merge Armature would result in a lot of NullReferenceExceptions being logged. --- Runtime/ModularAvatarMergeArmature.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Runtime/ModularAvatarMergeArmature.cs b/Runtime/ModularAvatarMergeArmature.cs index 103364ef..e990cdbb 100644 --- a/Runtime/ModularAvatarMergeArmature.cs +++ b/Runtime/ModularAvatarMergeArmature.cs @@ -131,6 +131,8 @@ namespace nadena.dev.modular_avatar.core private List<(Transform, Transform)> GetBonesForLock() { + if (this == null) return null; + var mergeRoot = this.transform; var baseRoot = mergeTarget.Get(this);