Forum rules - please read before posting.

Changing a menu element label at runtime

edited August 2024 in Technical Q&A

Hi

I'm missing something here. I'm trying to edit a menu elements label at run time as part of an intro sequence showing story points.

I have this code;

private MenuElement menuThing;    
menuThing = PlayerMenus.GetElementWithName("IntroMenu", "Text");
menuThing.OverrideLabel("My New Text Goes Here");

However the third line errors. Any idea what I've messed up?

Olly

Comments

  • It's OK. For some reason my Start() isn't being called so that MenuThing isn't being set. Not sure why it's not being triggered but have moved it to Awake().

  • The non-code way to handle this is to use Variable tokens.

    A String or PopUp global variable can be used to store the text, and then the Label can be set to display the Global Variable. Updating the variable's value with Variable: Set will in turn update the Menu.

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.