Skip to content

merge nested prefab process and prefab variant process to fix implementation difference. #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions Packages/com.vrchat.UdonSharp/Editor/UdonSharpPrefabDAG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,10 @@ public UdonSharpPrefabDAG(IEnumerable<GameObject> 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<Transform>(true).Select(e => e.gameObject))
{
if (child == vertex.Prefab)
{
continue;
}

if (PrefabUtility.IsAnyPrefabInstanceRoot(child))
{
GameObject parentPrefab = PrefabUtility.GetCorrespondingObjectFromSource(child);
Expand Down