Forum rules - please read before posting.

Change Menu Graphic by ActionList or Variable

Hi!

I am creating popups for different tutorials during the game. I have learned to change the text of the pop up menu using a Global Variable, it is very useful and simple. But I would like to illustrate each tutorial pop up with an explanatory image. I can't find a way to change the image for each case.

Thanks for all.

Comments

  • A brute-force way would be to create a Graphic element for each image, then show/hide them along with the text - but it'd be unwieldy if you had many.

    If you have your Menu rely on Unity UI for its rendering, though, you can make use of Unity's Animation system to animate which sprite is displayed in an Image component. If you then wire up transitions so that changing e.g. an Integer parameter in the Animator Controller causes a different sprite to show, you can then use the Object: Animate Action to control that parameter's value.

    See the Manual's "Unity UI menus" chapter for details on how Unity UI prefabs can be connected to AC's Menu system.

  • Thank you! First option works fine. I have around 15 different pop ups. I put 15 actions in the pop up close button for close all images each time.This way when I clic close I´m sure of the graphic turn hide and I only have to worry about show the next graphic when I want.

    Maybe it´s a weird method but it works for me! :D

  • 15 must be difficult to manage!

    While I recommend the Unity UI Animator method, if you're relying on an AC menu, then you can also change the graphic through script:

    Texture2D myNewTexture;
    MenuGraphic myGraphic = PlayerMenus.GetElementWithName ("MyMenu", "MyGraphicElement") as MenuGraphic;
    myGraphic.SetNormalGraphicTexture (myNewTexture);
    
  • Hi, i'm trying to achive the same result. With no success..
    I have an image with animator controller inside my menu (UnityUI). The menu is linked to menu in AC. I was able to change text with a variable, but not the image animation with action list. I created an action list on "menu turn on", but it loses reference to Animator controller so it never works. What am i doing wrong? Thanks in advance

  • edited December 2023

    You're using the Object: Animate Action? Check that the Animator object has a Constant ID component with Retain in prefab? checked, and that the Constant ID number is being recorded by the Action.

    Since this thread was posted though, you can now use the Menu: Update content Action to alter a Graphic element's texture - no need to rely on the Animator method if you're dealing with individual textures.

  • Yes i was using object animate and retain in prefab checked (constant id is under "missing" animator in actionlist)
    However the texture solution is smart and easier! Thanks!

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.