Use AssetDatabase.GetDependencies(prefabVariant, false) to get direct dependencies of a prefab variant, and the result is different from that of the original prefab when there are nested prefabs in the original prefab. It seems that the prefab variant doesn’t depend on the nested prefabs directly, but depends on the dependencies of the nested prefabs directly. Is this a bug?
Moved the thread since it doesn’t seem to be specific to 2019.3.
I can’t say for sure if it’s a bug, and the rest of my team are on vacation. But I’m not sure it’s necessarily a bug.
In terms of the file itself, the Prefab Variant only contains an instance of the Prefab Base, as well as any overrides. It doesn’t know about nested Prefabs in the base, so it makes sense that these are not direct dependencies.
When you say the Prefab Variant depends on the dependencies of the nested Prefabs directly, which dependencies are those? If it’s further nested Prefabs I’d be rather surprised. But if it’s things like materials or meshes - basically anything referenced through an Object Field in some component - these might be handled in a different way compared to how Prefabs that contain other Prefabs are handled, that cause these dependencies to be “inherited” by outer Prefabs and Prefab Variants. I’ll need to have someone else confirm this though.
Thanks for your reply As you say, the dependencies are monobehaviours and materials, etc. Not nested Prefabs.