- Home /
A Prefab of a Prefab
Hi guys,
I have a question here. Can I create a Prefab of a Prefab? Something like this:
I have a CharacterBase Prefab and I want to use it to create another Prefabs, like EnemyPrefab, MonsterPrefab, etc.
It's possible?
Answer by Robacks · Feb 23, 2014 at 11:13 AM
Yes you can. You can either duplicate your prefab with "Ctrl-D" or the Menu dialoge Edit->Duplicate. Drag and drop a (not necessarily modifyed) prefab instance from the Hierarchy will also work.
If you try to create kind of neasted prefabs, a prefab which is a part of another prefab, that wont work with the current version of unity. You can try to achive this by third party script solutions from the asset store. Or you can wait for unity to finish this feature. They are working on it but did not announce anything for it. I belive it will be in an 4.x release
Answer by usman.3d · Feb 23, 2014 at 01:59 PM
Attach Unity Script with your prefab. Then instantiate the other prefab within the script through Instantiate method. When the first prefab gets initialized in the scene, the associate script will automatically run, causing the other prefab to be instantiated.
Your answer
Follow this Question
Related Questions
Spawn Prefabs 1 Answer
Creating an array of prefabs? 4 Answers
Replacing empty gameobjects with prefabs 3 Answers