Forum rules - please read before posting.

EndCutscene Button in Menu

So I've got a menu activated via the ESC button (replacing the default one), and I'm currently detecting if a cutscene is running or not, and if it is, I have it pull up a different menu instead. This menu has a Skip Cutscene button, which I've tied to the EndCutscene input. The issue is that I can make a button simulate an input or run an actionlist or do something else, but not more than one.

The issue is that the button does indeed end the cutscene, but the menu remains onscreen. I need to make a way that clicking this button also closes out the menu. The way the manual describes this seems like this shouldn't be an issue (it mentions that you can use a menu button to skip a cutscene, but it doesn't say how to get rid of said menu after you've clicked it).

Hopefully this makes sense!

Comments

  • To clarify where I'm at, if I click the button that ends the cutscene, the cutscene does not end until I manually (via button or keyboard press) get rid of the menu. It's almost like the action of EndCutscene is cued up.

  • Does the menu pause the game when it's enabled? No change will be made to the game itself - including the state of ActionLists - while paused.

    You can confirm if this is the issue by temporarily unchecking Pause game when enabled? in the Menu's properties.

    You'll need to turn the menu off and then skip the cutscene, but there's no Action for doing the latter.

    Best to use a simple script that hooks into the OnMenuElementClick custom event to perform these two tasks when the button is clicked:

    using UnityEngine;
    using AC;
    
    public class SkipCutsceneButton : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnMenuElementClick += OnMenuElementClick; }
        private void OnDisable () { EventManager.OnMenuElementClick -= OnMenuElementClick; }
    
        private void OnMenuElementClick (Menu _menu, MenuElement _element, int _slot, int buttonPressed)
        {
            if (_menu.title == "MyMenu" && _element.title == "MyButton")
            {
                _menu.TurnOff ();
                KickStarter.actionListManager.EndCutscene ();
            }
        }
    
    }
    

    Paste that into a C# script named SkipCutsceneButton.cs, and change "MyMenu" and "MyButton" to match the names of the menu/button you want it to work with. Then attach to a GameObject in your scenes, or the Player prefab so that it's always present in all.

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.