From 36b13b8192202efb9d0800fff07b72ab2c808af5 Mon Sep 17 00:00:00 2001 From: bd_ Date: Tue, 5 Sep 2023 20:16:41 +0900 Subject: [PATCH] chore: protect against prefab instances leaking into play mode --- .../nadena.dev.modular-avatar/Editor/MergeArmatureHook.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Packages/nadena.dev.modular-avatar/Editor/MergeArmatureHook.cs b/Packages/nadena.dev.modular-avatar/Editor/MergeArmatureHook.cs index 1e627692..a6dad482 100644 --- a/Packages/nadena.dev.modular-avatar/Editor/MergeArmatureHook.cs +++ b/Packages/nadena.dev.modular-avatar/Editor/MergeArmatureHook.cs @@ -410,6 +410,14 @@ namespace nadena.dev.modular_avatar.core.editor } } + var isPrefabInstance = PrefabUtility.IsPartOfPrefabInstance(src.transform); + var isPrefabAsset = PrefabUtility.IsPartOfPrefabAsset(src.transform); + + if (isPrefabAsset || isPrefabInstance) + { + throw new Exception("Cannot merge prefab instances or prefab assets"); + } + src.transform.SetParent(mergedSrcBone.transform, true); if (config.mangleNames) {