Answer the question
In order to leave comments, you need to log in
How can I move cloned objects on the playing field?
There is a Circle object on the stage. At the start of the game, it is cloned and 10 copies of it are placed in random places on the playing field. When one of the copies is destroyed, a new one appears in a random place. That is, there are always 10 of them. I need that when one of the copies is destroyed, the rest move to random places on this playing field in a second. How can I implement this?
Answer the question
In order to leave comments, you need to log in
public GameObject[] allObject;
allBubbles = GameObject.FindGameObjectsWithTag("object");
foreach (GameObject elements in allObject)
{
{
elements.transform.position = new Vector2(x1, x2), Random.Range(y1, y2));
}
}
This means that at the start of the game there is, in theory, 1 function that creates 10 copies and places them in some data structure and 1 more function that assigns random places to them.
Find this function that moves them to random places and just run it again after each destruction. Otherwise hello vange.
I take it you didn't write it yourself?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question