Forum rules - please read before posting.

Is there a way to close all open menus without referring to each specifically?

Comments

  • Yes, there's a function for that.

    PlayerMenus.ForceOffAllMenus()

  • Thanks!
    How can I call that function at the required time using AGs action lists?

  • edited September 2019

    Two options:

    1. Create your own action. Here's official tutorial.

    2. Use the action Object: Call event

    • Create a new c# script
    • Create new method called whatever you want - CloseAllMenus for example
    • Put this line in the method: PlayerMenus.ForceOffAllMenus()
    • Attach this script to any object in the scene
    • Use the action Object: Call event (attach the object and select your created method)

    void CloseAllMenus() { PlayerMenus.ForceOffAllMenus(); }

    Note: Don't forget that your c# script needs to have using AC at the beginning

  • Place it in a custom script function, and call that function with either the Object: Call event or Object: Send message Actions.

  • So I've tried Keks's second suggestion.
    But when I use the call event and select the method I created (close menus) I'm presented with a list of functions (?) I don't know which to choose?
    Am I doing this right? what should I choose from the list?
    Thanks!
    See pics of the script and list -

  • Nearly there. Just make your "closeAllMenus" function public:

    public void closeAllMenus(){
    

    It'll then be an option in the event drop-down.

    If you place this component on a GameObject, and then make it a prefab, you can then reference this prefab in the Action so that it can be called from any scene.

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.