- Home /
How to compare the positions of two or more instantiated gameobjects (clones) with different tags?
I tried the following function. But, its not working.
void GameLogic() { GameObject one = GameObject.FindGameObjectWithTag("One"); GameObject two = GameObject.FindGameObjectWithTag("Two");
if (one.transform.position.x == two.transform.position.x)
{
Debug.Log("inline");
}
}
Here, gameobjects are clones of the original.
Answer by rohitkvasanth · Feb 07, 2019 at 06:55 AM
create tags "one","two" set the tags dynamically using script when instantiating. use your function top find them.
Your answer
Follow this Question
Related Questions
extra GameObjects Spawning 2 Answers
how do I reference a clones of a instantiated game object and only the clones In a script? 1 Answer
Having problem with making non networked objects only be intractable with local player 0 Answers
I need to change the color of one instantiate object 1 Answer
Make a game object in a scene into a prefab with script 1 Answer