unity3d - Unity 2d script does not work when I clone the object -
i have object whith attached scrypt.
public gameobject scoreinfo; static int currentscore = 0; void onmousedown() //кнопка мыши нажата { currentscore++; scoreinfo.getcomponent<text>().text = currentscore.tostring(); }
i clone in unity 2d.
gameobject tmpobj = gameobject.instantiate(spritetoduplicate, worldvector, quaternion.identity) gameobject;
inspector showes script attached every clone , real 1 (Изображение), when click clone not work, click real 1 work finley.
understood. when cloning, z axis -10. thays why click did not pass.
tmpobj.transform.position = new vector3(tmpobj.transform.position.x, tmpobj.transform.position.y, 0);
Comments
Post a Comment