Hello,
I'm trying to make an animation, where the player picks up an item, and then the item has an animation into a menu. The problem is that I can't seem to find the screen position of this menu item, it always seems to have a large offset relative to the screen. I've digged into the code as well, and couldn't find much info.
I've tried to use some of the Menu's properties to get this position, but didn't expect some of the results:
- manualPosition - returns an offset from the screen
- canvas - returns null
- rectTransform - returns null
- GetRect() - returns (0, 0)
- Centre - returns an offset even farther than manualPosition
Is there a way to get the position of a menu (with 'Aligned' position), relative to the screen, so that I can get World Coordinates based on that?
Thank you in advance.
Comments
GetRect should indeed return the boundary of the Menu - lets see what your Menu's properties look like in the Menu Manager.
You also have the option of reading GetSlotCentre, should you be able to work with the position of an element.
I just needed to convert that screen space into World Space, but I also had to do this:
centre.y = Screen.height - centre.y;
It seems that Rects and Screen spaces have different starting points. But apart from that, that's the property I needed.
Thank you so much!