- Home /
error on moving object to end of spawned object
hi i try to spawn a place in game first time it works good but after it this give me this error
transform.position assign attempt for 'spawnplace' is not valid. Input position is { 0.000000, 0.000000, Infinity }.
UnityEngine.Transform:Translate(Vector3)
groundspawner:Update() (at Assets/code/groundspawner.cs:23)
code :
void Update () {
if((player.transform.position.z + 10f) <= spawnplace.transform.position.z)
{
Instantiate(spawnobject,spawnplace.transform.position,Quaternion.identity);
if(GameObject.Find("end of expander"))
{
GameObject a = GameObject.Find("end of expander");
spawnplace.transform.Translate(a.transform.position);
GameObject.Destroy(a);
}
}
}
spawnplace is a cube i use to spawn on there and i move it to end of spawned of object but it give me up error for this line
spawnplace.transform.Translate(a.transform.position);
Comment