Forum rules - please read before posting.

Changing button text in runtime

edited June 2022 in Technical Q&A

I'm using Unity UI Prefab on my menus and need to update the text on a button through script.

Updating the label directly works great until its connected as "Linked Button" in the menu manager, after which it seems that the text is set updated continuously on Update()?.

Overriding it on every LateUpdate() actually hurst the FPS a surprising amount. Is there any way to programmatically get the MenuElement based on the text control and update it that way?

Thanks!

Comments

  • What Element type is it linked to? Button?

    Button labels support tokens, so the label text could be e.g. [var:3] and mapped to a String variable with ID = 3, which is then updated.

    Alternatively, you could detact the Button from the AC Menu Manager, and handle its click behaviour manually by e.g. having it run an ActionList asset by invoking its Interact function.

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.