Component on animated object while keeping the prefab

Hey!

I have an animated object (animated in an external program) And on certain parts within this objects hierarchy I would like to add components.

Within the project folder in Unity I cannot see the entire hierarchy.

I can of course just drag the component on the object(in its hierarchy) when its in the scene but then I lose my prefab connection.

so for instance: if the object was a arm and I would like a box collider + script on the hand, what would be the best way of doing this without losing the prefab connection ?

And if that's not possible, would it be possible to make an editor script that adds the required components ? or maybe add the components at runtime ?

Any point in the right direction would be awesome!

thanks a lot!

cheers,

Vin

Edit what you need and add more components etc and make it a new prefab, and delete old one.

I think this question might contain the answer you’re looking for.

As a complement, what I do in this sort of case is to create a public GameObject variable named, for instance, “HandScriptObject”, in the parent’s script. Into that slot you drag the hand object you want the script attached to. You can then programmatically add the script component to the hand object in Awake(), or instantiate an inspector-exposed prefab and parent it to the hand.

Don’t hesitate to experiment with GameObjects! I found out that you can work your way around a lot of problems/limitations by using the right hierarchy setup.