Hello!
I found some code which could find the position of another sprite’s tag, however, I only want to find the y value. I have tried this
if (yPos < GameObject.FindGameObjectWithTag("tagPos").transform.position;
but it doesn’t work, as I am trying to compare a variable with 3 positions from the vector3. Is there a way to just find the y position?
,Hello!
I found some code which could find the position of another sprite with its tag.
GameObject.FindGameObjectWithTag("tagName").transform.position;
and I am trying to compare its y value with a set variable
if (yPos >GameObject.FindGameObjectWithTag("tagName").transform.position;
However, it doesn’t work as it is trying to compare a single variable with 3 different positions. Is there a way I can just find the y position?
Thanks!