I find PrefabUtility to be quite a confusing API, but understand that nested prefabs and prefab variants have made it so. However i can’t seem to find a single method in PrefabUtility that gets me what i want here.
I have a prefab (let’s call it A) that contains a nested prefab, this nested prefab is itself a prefab variant (let’s call it BVariant).
So we have A, we have B and BVariant.
What i want to get is the BVariant asset from the BVariant nested prefab instance in A.
GetCorrespondingObjectFromSource returns BVariant (object in prefab A) as stated in the docs.
GetCorrespondingObjectFromOriginalSource gets me prefab asset B, not BVariant.
The only way i have found to get what i want so far is to call GetCorrespondingObjectFromSource twice if the prefab is not the IsOutermostPrefabInstanceRoot, which just doesn’t seem right.
Is there a suggested way of doing this? Or am i missing something?
Unity version: 2021.3.16
Thanks.