Hi guys, I want to make a GUI where you can select the type of player (model) you want and then instantiate this model in the game when it starts. Even though I still don’t know how to do it because I know that I could instantiate this model using: Unity - Scripting API: Object.Instantiate
but I don’t know in this case how to do it because the model is not called as a father, instead of that it is called as a child of another gameobject. You can see that in the following image:
in this image, I have my player object named “Jugador” and as a child I have my main model named “father”.
Please don’t suggest me to unchild this model because I need this model as a child.
A little confused. You want to have a screen that allows you to select a model to use in the game. Then, you want to load a scene and have that model instantiate at a spawn point so that you can move around.
If I am reading this correctly, you want to start with 2 scenes. 1 is the one that you pick an “avatar”, the 2nd is the one you move around in.
I would do this with a simple “GameController” that stays in the world. (use DontDestroyOnLoad)
This would have a script that does your instantiations.
Each scene, then looks for a GameObject named “GameController” then calls a function (Init) that will do the instantiation on that objects “Start”
So you will need to create the GameController script and a “SceneController” Script that talk to each other.
Thanks bigmisterb, and yes what I want is that 2 scenes but the problem is that instantiating the model would make the object as a father, and as you see in my picture, I need it as a child from another gameobject. Do you think I can do this with GameController too?
could you not just change the mesh component of the “father” gameobject when the user clicks on the gui? it’ll always exist (ie you don’t need instantiate) and always be a child but the appearance will change…