Forum rules - please read before posting.

OnRelease clicks

Hi Chris,
i have context sensitive point and click game for touchscreen, but need to solve few problems. Setting "on release click" for menus is great and i think being able to set it gamewide would fix my other issues as well. Or maybe theres another solution i dont see.

Anyway.. the problem. I have cursor set to drag in touchscreen options, so ppl can discover items by swiping around and when they find something, mouseover label pops. But when they cross navmesh or start the swiping near it, character keeps moving. Is it posible set this to behave OnRelease?
And minor issue number two- can the hotspot labels disapear on release as well?

Thanks

Comments

  • Welcome to the community, @Skywaalker.

    But when they cross navmesh or start the swiping near it, character keeps moving.

    So that I'm clear: does this occur mid-drag, or only at the moment you first touch? And is this occuring for you in the Editor, or only builds?

    can the hotspot labels disapear on release as well?

    Where is the cursor at this time? If it's over the Hotspot and you're still in gameplay, the label will remain there - the "drag" cursor for touchscreens acts like a regular cursor even when not held.

  • Thanks.
    Didnt thought there would be diference. In editor char keeps moving all the time, but in build the behavior is fine if you start outside navmesh reach. Still, OnRelease clicks would prevent player moving even when they start the drag in navmesh.

    Where is the cursor at this time?
    Its on the hotspot, but since its touch controled, theres no visible cursor and it looks kind of weird, if the player is not interacting with the screen, yet in the mid bottom (my labels location) it keeps displaying the label. Display timer would be great for that purpose.

  • OnRelease clicks would prevent player moving even when they start the drag in navmesh.

    Noted, thanks. I'm looking into this as a potential option.

    Display timer would be great for that purpose.

    This script will "lock" your Hotspot menu if no touch input is detected for 3 seconds. It may need some tweaking, but give it a try by placing it in your scene:

    using UnityEngine;
    using AC;
    
    public class LockMenuTimer : MonoBehaviour
    {
    
        public string menuToClose = "Hotspot";
        public float timeUntilClose = 3f;
        private float timer;
        private Menu menu;
    
        void Update ()
        {
            if (menu == null)
            {
                menu = PlayerMenus.GetMenuWithName (menuToClose);
                if (menu == null)
                {
                    return;
                }
            }
    
            bool hasTouch = Input.touchCount > 0;
            if (hasTouch)
            {
                timer = timeUntilClose;
                menu.isLocked = false;
            }
            else
            {
                timer -= Time.deltaTime;
                if (timer <= 0f)
                {
                    menu.isLocked = true;
                }
            }
        }
    
    }
    
  • Thank you, would be cool to have it.

    I will pass on the part 2 tho, have zero coding skills :smiley:

  • Big thanks for adding this functionality to new version so quickly! Just read the 1.74 release notes🙃
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.