Is creating root prefabs a best practise?


following up with the naming issue here: here the generic projectile is a child of the fireball projectile:

is it best practise to always have a root prefab, e.g. “_RootProjectile” and derive all variants from that one?This way it would always be clear and easy to spot, which one the parent is. or is this getting too messy with more prefabs?
I’m a newbie, but I wondered why this is not done to avoid confusion.


It think it depeends on the individual…
If the question was about classes, I would almost always say “yes”, it is a best practice to employ inheritance.
With Prefabs, it can get complicated if you’re not careful about how you set things up… Everything in the base (root) prefab will be in the child prefabs. You can’t remove objects from the heirarchy or re-arrange them (though you can deactivate them). This makes it important to make your base as generic as possible, and add details as you branch out.
The big advantage, however, is that you can make broad changes across your collection of prefabs by only changing the base prefab, and you can ensure that all of your child prefabs have the necessary components to do their jobs…
In short, it’s up to you.

This topic was automatically closed after 21 hours. New replies are no longer allowed.