I am just trying to make a square object get destroyed and have a new one instantiated in it’s place.
What happens now is that the first object will destroy, and the new one will appear, but it will always appear in the middle of the screen, and not in it’s parent transform that holds the script.
I have tried setting the vectors, using code to set the parent and a few other things but nothing works. Here, and thanks in advance!
public Transform RaisingBlock;
public GameObject lava1;
public GameObject raisedBlock1;
public GameObject loweredBlock1;
void Start()
{
StartCoroutine("MyEvent");
}
private IEnumerator MyEvent()
{
while(true)
{
yield return new WaitForSeconds(2f);
Destroy(this.gameObject);
Instantiate(lava1);
}
}
}