From fd9d6de5aa86cf52d987f491b222e4c4e8e3b14d Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 16 Feb 2023 18:27:08 +0900 Subject: [PATCH] merge nested prefab process and prefab variant process to fix implementation difference. --- .../Editor/UdonSharpPrefabDAG.cs | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/Packages/com.vrchat.UdonSharp/Editor/UdonSharpPrefabDAG.cs b/Packages/com.vrchat.UdonSharp/Editor/UdonSharpPrefabDAG.cs index 746d1229..362272b7 100644 --- a/Packages/com.vrchat.UdonSharp/Editor/UdonSharpPrefabDAG.cs +++ b/Packages/com.vrchat.UdonSharp/Editor/UdonSharpPrefabDAG.cs @@ -40,26 +40,10 @@ public UdonSharpPrefabDAG(IEnumerable allPrefabRoots) foreach (Vertex vertex in _vertices) { - if (PrefabUtility.IsPartOfVariantPrefab(vertex.Prefab)) - { - Vertex parent = _vertexLookup[PrefabUtility.GetCorrespondingObjectFromSource(vertex.Prefab)]; - - if (parent == vertex) - { - throw new Exception($"Parent of vertex cannot be the same as the vertex '{vertex.Prefab}'"); - } - - vertex.Parents.Add(parent); - parent.Children.Add(vertex); - } - + // We don't have to process prefab variant and nested prefab separately + // because prefab variant is just a nested prefab at the root GameObject of prefab. foreach (GameObject child in vertex.Prefab.GetComponentsInChildren(true).Select(e => e.gameObject)) { - if (child == vertex.Prefab) - { - continue; - } - if (PrefabUtility.IsAnyPrefabInstanceRoot(child)) { GameObject parentPrefab = PrefabUtility.GetCorrespondingObjectFromSource(child);