Forum rules - please read before posting.

Hotspot Interaction on Release instead on Click for Straight to Cursor movement

We are developing a 2D mobile Game where the player can move around a long room around the x axis.
For Movement we use the Straight to Cursor option so that the player can hold down the mouse in order to move instead of having to click a million times with the standard point & Click movement.

We have encountered an Issue with Hotspots. When the player accidentally clicks on a hotspot and then continues to hold because he want wo move around. The Hotspot registered the click and triggers the use interaction. Technically there is nothing wrong. The hotspot detected a click and triggered an interaction. But in this case we just wanted to move around and do not interact with an hotspot.

Is there any way to trigger an Hotspot interaction on Release (GetMouseButtonUp?) instead of an Click?

Here is a Video where i try to walk around the level and if i happen to start the movement process while clicking on the hotspot it gets triggered. (I click and hold on the hotspot)
https://1drv.ms/v/s!AsV-gXjtoqj_iIFOQl-lcbQHPMXJ7g?e=OAmmXX

If i click on a hotspot and then hold the finger / mouse down i do not want to interact with the hotspot.
If i simply click / tap the hotspot without holding (releasing the mouse / finger) i want to interact with it.

Comments

  • Welcome to the community, @FabulaFK.

    It's possible to alter the way inputs are registered by writing a custom script that overrides AC's input delegates - see the Manual's "Remapping inputs" chapter.

    I'd like to recreate the issue on my end. Could you share screenshots showing your Settings Manager, or - better yet - PM me your Managers, Player prefab and a test scene?

    Please let me know your AC and Unity version numbers as well.

  • Recreated, thanks for the details.

    I'm not sure it's technically a bug, but you can get the behaviour you want by implementing a custom interaction system.

    To do this, set your Settings Manager's Interaction method to Custom Script. That'll still allow Hotspots to be detected as normal, but they'll then need a separate script to have input result in interactions.

    Here's such a script. It's very basic, and doesn't deal with inventory etc, but that can be added in later. For now, it should at least cause Hotspot "Use" interactions to run when releasing a click/tap:

    using UnityEngine;
    using AC;
    
    public class CustomInteraction : MonoBehaviour
    {
    
        private Hotspot hotspot;
    
        void Update ()
        {
            if (KickStarter.playerInteraction.GetActiveHotspot ())
            {
                if (ClickDown)
                {
                    hotspot = KickStarter.playerInteraction.GetActiveHotspot ();
                }
                if (ClickUp)
                {
                    if (hotspot && hotspot == KickStarter.playerInteraction.GetActiveHotspot ())
                    {
                        hotspot.RunUseInteraction ();
                    }
                    hotspot = null;
                }
            }
        }
    
        private bool ClickDown => (Input.GetMouseButtonDown (0) || (Input.touchCount == 1 && Input.GetTouch (0).phase == TouchPhase.Began));
        private bool ClickUp => (Input.GetMouseButtonUp (0) || (Input.touchCount == 1 && Input.GetTouch (0).phase == TouchPhase.Ended));
    
    }
    

    The Manual's "Custom interaction systems" and "Interaction scripting" chapters have more on this topic.

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.