Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Cursor icon follow the mouse while the interaction is active

Problem: I have multiple hotspots. Each one activates different **interactions **text shown as subtitles. The problem is when a subtitle/interaction (skippable by tapping) is on and at the same time I tap/click on another hotspot - the subtitle is skipped but the cursor icon activates and follows the mouse (in mobile, the cursor stays on/active on that region).

If I click to another part of the screen (without hotspot/interaction), everything is good (interaction is skipped, the cursor icon don't appear/follow the mouse cursor or stay in that position).

When I deactivate the skippable interaction, the problem doesn't occur.

I'm using a Context-sensitive (interaction method) with the touch screen input method and skippable interaction. AC 1.70 / Unity 2018.4

What I want to achieve is that when I click to another hotspot (the cursor icon disappear after I remove the tap/click or in the case of the mouse - don't follow the cursor)

https://imgur.com/3j4Urlc

https://imgur.com/AAf4iQ0

https://imgur.com/KoBnv9w

Comments

  • edited February 17

    This would require some custom scripting to override the cursor's position - see the Manual's "Remapping inputs" chapter. The code would be different for mobile vs desktop platforms, but here's a sample for the mobile platform:

    using UnityEngine;
    using AC;
    
    public class FixCursorCutscenePosition : MonoBehaviour
    {
    
        private Vector2 lastPosition;
    
        private void Start ()
        {
            KickStarter.playerInput.InputTouchPositionDelegate = My_InputTouchPosition;
        }
    
        private Vector2 My_InputTouchPosition (int index)
        {
            if (Input.touchCount > index)
            {
                if (KickStarter.stateHandler.IsInGameplay ())
                {
                    if (index == 0) lastPosition = Input.GetTouch (index).position;
    
                    return Input.GetTouch (index).position;
                }
                return lastPosition;
            }
            return Vector2.zero;
        }
    }
    

    This records the last-tapped position when during gameplay, and returns this same position when a cutscene is playing. Does this have the desired effect, provided the Hotspot Interactions block gameplay? Note that it won't work when testing in the Editor.

  • edited February 17

    Dear Chris, after I tried to put the fix I got an error:

    No overload for 'My_InputTouchPosition' matches delegate 'PlayerInput.InputTouchPositionDelegate'

    on the line from Start()

  • edited February 18

    Update to the latest release and it should compile.

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.
Do NOT follow this link or you will be banned from the site!