How to instatiate a prefab with all it's characteristics?,Question about how to Instatiate a prefab with all it's characteristics
Hi
May be this is question is answered somewhere but I can't find it. This is my problem, I have a prefab with several object childs:
It has an attached a "healt slider", "aim slide" a "game object" and this game object has a script in order to shoot a bullet. It works but when I instatiated the "Tank", these properties are not instatiated.
This is the script so far, but I cannot understand how to apply all this stuff to the prefab and instatiated.
Thanks.,
Answer by Hamburgert · Feb 05, 2018 at 09:03 AM
There are two places you can change settings on a prefab. You should change setting in the Project view, NOT in the Hierarchy view.
Do this:
The prefab can be found in the Project view, and changing settings here will apply to to your instantiated gameobjects, and will also change all current gameobject in the scene with this prefab connection.
The other way
It sounds like you are trying to change a single gameObject. The Hierarchy view shows each individual gameobject in the scene. Changing settings here will only modify this single gameobject. You can apply these settings to the prefab by clicking "Apply" near the top of the Inspector, assuming the connection to the prefab is intact. Warning: This will change ALL gameobjects in the scene with the same prefab connection.
Your answer
Follow this Question
Related Questions
Unity overwrites prefab values in runtime 0 Answers
Create gameobject in other scene... 0 Answers
Prefabs not instantiating after build 0 Answers
References of a Prefab 1 Answer
prefab/instantiate problem. C#,Instanciate/Prefab problem. 0 Answers