#Setting the position of an object on a canvas. Help: Not the right position!

1 messages · Page 1 of 1 (latest)

coral quiver
#

I am trying to set the coordinates of offset to my gameobject. I am setting the gameobject as a child under the canvas so it can be displayed as a part of the UI.

However, it does not spawn in the right place. The offset vector is set to the inspector transform points of where I want the object to be. Even using transform.TransformPoint(offset) does not set it in the right position. any help?

lethal vapor
#

oh no!

#

so sory

#

😭

granite forge
#

When setting the position of a RectTransform like a UI object, you should use .anchoredPosition instead of position. Spawn it in first, then change the anchoredPosition instead of passing a value to Instantiate