- Home /
Question by
Captain_Dando · Apr 12, 2013 at 10:45 AM ·
instantiatemodelcomponent
How can I set an instantiated gameobject's model in code?
Hi everyone, in my code I have a function which creates a gameobject for each object in a list. They each appear in the hierarchy, but now I would like to give each of them a different model depending on their place in the loop.
For simplicity's sake, here is an example of the code without the loop.
fieldCharacter = new GameObject();
fieldCharacter.name = "Doug";
fieldCharacter.tag = "Character";
Is there a way to do this?
Comment
Best Answer
Answer by paulaceccon · Apr 12, 2013 at 12:29 PM
Did you checked the Instantiate method? With it, you can instantiate your prefabs.
is it possible to change the model of the prefab once it's been created?