Forum rules - please read before posting.

Closing the interaction via scripting

Hello, just another thing; how do I go about closing the interaction menu via script say if I want to cancel an interaction via keyboard or after I select an interaction? This is just to save space on action scripts.

Comments

  • Nevermind, worked it out :)

    using UnityEngine;
    using AC;
    
    public class CancelInteractions : MonoBehaviour
    {
        void Update()
        {
            if (Input.GetButtonDown("Cancel") || Input.GetButtonDown("InteractionA") && PlayerMenus.GetMenuWithName("Interaction").IsOn())
            {
                AC.KickStarter.playerInteraction.DeselectHotspot(); // De - select the current Hotspot
                AC.PlayerMenus.GetMenuWithName("Interaction").TurnOff();//Turn off Interaction Menu
            }
            else
            {
                return;
            }
    
            if ((Input.GetButtonDown("Cancel")) && PlayerMenus.GetMenuWithName("Inventory").IsOn())
            {
                AC.PlayerMenus.GetMenuWithName("Inventory").TurnOff();//Turn off Inventory Menu
                AC.PlayerMenus.GetMenuWithName("Interaction").TurnOn();//Turn back on Interaction Menu
    
            }
            else
            {
                return;
            }
        }
    }
    
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.