Forum rules - please read before posting.

Issues with disabling Cursor & Interactions (System Manager)

Hi there,

When interacting with hotspots (in first person) I am (via actionlist):
-disabling the hotspot to remove label UI
-disabling cursor and interactions (to prevent overlapping interactions/text)

These are activated again after the interaction is over.

This seems to work fine until, after a couple of interactions with various hotspots, the cursor and interactions are no longer being disabled and allow for you to interact with multiple hotspots at once (overlapping text etc). Something is causing the system manager aspect to be ignored.

Here's an example actionlist:
https://imgur.com/a/OBVqPhK

Using Unity 2020 and latest version of AC.

Thanks for the help.

Comments

  • The systems in your ActionList will be disabled and re-enabled again instantly, because no speech text has been supplied in the speech Action.

    With speech text inserted so that the ActionList takes time to run, does it matter which Hotspots are interacted with? Can you, for example, click on the same Hotspot multiple times to recreate the problem?

    I'm not following your meaning of overlapping interactions/text, though. Are you looking to be able to move around in regular gameplay, but not interact with objects while the interaction is running?

    Or is this more visual, in terms of UI etc? If you want to prevent e.g. the Hotspot menu from showing, you can lock it with the Menu: Change state Action, rather than disable the Interaction system/

  • myqmyq
    edited November 2021
    Hi thanks for the help,

    Yes this continues to occur even if I add text or even add a waiting period. But strangely the action list will work for a while until I click on a few in quick sequence, then it breaks. From then on the cursor and interactions will no longer disable at all. I will check if this occurs if I repeatedly use the same hotspot.

    This is both a UI and action overlap issue eg. I don’t want the player to keep triggering multiple objects that play narration (which then visually overlap in UI) and some interactions require doors to be locked for a short period while an action is running for example.

    The only way around this issue is manually disabling all hotspots the player is in reach of (which seems too complex).

    I’m unsure if there’s something else I’m triggering that breaks the system manger.
  • I can't recreate the issue you're facing, and I would need full details on your project to learn the cause, but if you want to perform something like disable the interaction system, or disable all Hotspots, while a background Interaction is running - then it's best to automate it through script.

    AC's custom event system provides a means to hook custom code into common AC tasks - for example, when a Hotspot is interacted with:

    For example: this script, AutoDisableInteractions.cs, turns off all Hotspots in a scene while a background Interaction is run:

    using UnityEngine;
    using AC;
    
    public class AutoDisableInteractions : MonoBehaviour
    {
    
        private Interaction awaitingInteraction;
    
        private void OnEnable ()
        {
            EventManager.OnHotspotInteract += OnHotspotInteract;
            EventManager.OnEndActionList += OnEndActionList;
        }
    
        private void OnDisable ()
        {
            EventManager.OnEndActionList -= OnEndActionList;
            EventManager.OnHotspotInteract -= OnHotspotInteract;
        }
    
        private void OnHotspotInteract (Hotspot hotspot, AC.Button button)
        {
            if (button.interaction && button.interaction.actionListType == ActionListType.RunInBackground)
            {
                awaitingInteraction = button.interaction;
                foreach (Hotspot _hotspot in KickStarter.stateHandler.Hotspots)
                {
                    _hotspot.TurnOff ();
                }
            }
        }
    
        private void OnEndActionList (ActionList actionList, ActionListAsset actionListAsset, bool isSkipping)
        {
            if (actionList == awaitingInteraction)
            {
                awaitingInteraction = null;
    
                foreach (Hotspot hotspot in KickStarter.stateHandler.Hotspots)
                {
                    hotspot.TurnOn ();
                }
            }
        }
    
    }
    

    It can be amended to e.g. only work with Hotspots given a particular tag, but give it a try and see if it resolves the original issue.

  • Hi Chris! Thanks for this. I will try it out for some situations I have.

    I figured out that my issue was with a single hotspot that had a system manager running back into itself at the end of the actionlist, meaning that it was always running in the background and re-enabling everything.

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.