Answer the question
In order to leave comments, you need to log in
How to correctly set the position of an object relative to another object?
I have a Container object that I instantiate and then assign a position to it using the SetPosition method
public void SetPosition(GameObject itemButton)
{
Vector2 position;
position.x = itemButton.GetComponent<RectTransform>().transform.position.x;
position.y = itemButton.GetComponent<RectTransform>().transform.position.y + 50;
Container.transform.position = position;
}
Answer the question
In order to leave comments, you need to log in
I don't understand how this script works, but maybe the problem is that you are confusing screen coordinates with normal ones. Someone had a similar problem.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question