Question by
Cibum · Feb 09, 2017 at 05:15 PM ·
instantiateduplicate
When I Instansiate a gameobject as a children the parent duplicates. Why?
void Start () {
newModel = new GameObject();
newModel.name = "newModel";
}
void Update () {
if (Input.GetMouseButtonDown(0))
{
GameObject cloneBlock = Instantiate(block, selectedBlock, Quaternion.identity, newModel.transform);
}
}
Why does newModel duplicate itself when I click the mouse button?
Please help!
Comment
Answer by Happy-Zomby · Feb 10, 2017 at 04:32 PM
Hi, doesn't your prefab block have this script attached to it? If so it running the start part every time you instantiate it... hence creating another newModel hope that helps,