Add different hats to a model

I have a model of a bunny and want to get a script that allows me to add different types of hats, glasses, eyes, ect to the model as the player collects these items.

What kind of implementation would be the slickest? I am a flash developer who is making the switch and don’t quite know how unity should handle this. Thanks all!

Depending on how many varieties there are (for example, if you have 100s of accessories that can be applied this might not be a great solution) you could make every accessory a child of the rabbit in the correct positioning and then deactivate them all, activating the correct one through script when the item is collected.

Well, the usual technique is to switch textures if the hats are all the same shape, switch meshes and textures for different shapes of hats, and have an empty game object at the location where you want to Instantiate them.

just do what sunman said as that is the best answer but if they each have different animations for each hat you have to have the bunny being spawned with the hat because then you would spawn the bunny and the hat which isn’t as simple.

So the hats aren’t going to be the same model (for example a pirate hat, a mohawk, a Chinese hat, ect) So I am not going to be changing the texture of the mesh itself; however, I should be able to create an empty game object at the location I want to add the hat all the same right? So instead of changing the texture I should just be able to create or destroy hats as children of the model correct?

just spawn the hat where you want it via a prefab.

Excellent, easy enough. So basically game objects and prefabs are just like Movie clips in Flash… cool!

That’s right, except that if you develop that game for iPhone, you should really not stock gameobjects like that. For performance issues, it’s better to merge all.

If it’s for pc, it’s ok :wink: