Forum rules - please read before posting.

MenuElement Relative Position via script

edited August 2014 in Technical Q&A
I'm trying to set some menu position via script to adjust the menu using an action.
I tried the SetRelativePosition method but seems not working (or simply I need to understand it).

Let's make an example:
I'd like to set the MenuElement at this relative position: 0, 50.
I could do it with the Menu Manager, setting
Position: Relative to Menu Size
x: 0, y: 50.

Doing so I place the Element in the middle left of the menu.

I tried to implement the same thing using the method:
_menuElement.SetRelativePosition(new Vector2 (0, 50f));

But doing so the element appears at the end of the screen.

How could I set Position: Relative to Menu Size with the scripts?
Thank you very much.

Comments

  • But doing so the element appears at the end of the screen.

    But which end?

    Try calling the menu's RecalculateSize function afterwards.  It's not advisable to manually re-position elements through script, but know that you can also hide and show elements using the Menu: Change state Action.  With that, you could have two elements that have the same appearance, but are in two different places - and simple swap one out for the other.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.