References to a scene object's prefab parent's prefab parent (at any depth) are now found correctly

This commit is contained in:
yasirkula
2021-12-19 19:02:35 +03:00
parent 7b3b7957d8
commit f724dd2fdb
@@ -350,12 +350,16 @@ namespace AssetUsageDetectorNamespace
if( searchPrefabConnections )
{
#if UNITY_2018_3_OR_NEWER
Object prefab = PrefabUtility.GetCorrespondingObjectFromSource( go );
#else
Object prefab = PrefabUtility.GetPrefabParent( go );
Object prefab = go;
while( prefab = PrefabUtility.GetCorrespondingObjectFromSource( prefab ) )
#endif
if( objectsToSearchSet.Contains( prefab ) && assetsToSearchRootPrefabs.ContainsFast( prefab as GameObject ) )
referenceNode.AddLinkTo( GetReferenceNode( prefab ), "Prefab object" );
{
#if !UNITY_2018_3_OR_NEWER
Object prefab = PrefabUtility.GetPrefabParent( go );
#endif
if( objectsToSearchSet.Contains( prefab ) && assetsToSearchRootPrefabs.ContainsFast( prefab as GameObject ) )
referenceNode.AddLinkTo( GetReferenceNode( prefab ), "Prefab object" );
}
}
// Search through all the components of the object