Forum rules - please read before posting.

D-Pad speed in Menus

edited August 2021 in Technical Q&A

Hello!

Is there a way to set the D-Pad speed ( Vertical ) to move quickly up and down in the menu? Right now I have to hit the up/down to move one item at a time and there seems to be a delay if I click too fast.

Thanks!

Comments

  • Is this for an AC menu, or Unity UI?

    When directly-navigating an AC menu, selecting an element will lock scrolling until the input magnitude goes below a threshold of 0.05.

    I can look into making this configurable, but you can alter this value manually by editing the following line in PlayerInput.cs:

    if (rawInput.y < 0.05f && rawInput.y > -0.05f && rawInput.x < 0.05f && rawInput.x > -0.05f) 
    
  • edited August 2021

    Yes, it's AC menu. I would like it if I can just hold the button down and it would move until I let go. Trying to avoid having to click up or down each line.

    Adding this feature would be nice, as a configurable item.

    A suggestion would be if you can modify the Digital Axis Gravity and Digital Axis Sensitivity. I was able to set them both to 100 and it seems to be good.

  • edited August 2021

    Custom scroll behaviour of that type can be implemented by subclassing the PlayerInput script and having it replace the Player Input component on your GameEngine object:

    using UnityEngine;
    using AC;
    
    public class CustomPlayerInput : PlayerInput
    {
    
        private const float delay = 0.2f;
        private float scrollReleaseTime;
        private bool lastFrameLocked;
    
        private void Update ()
        {
            if (scrollingLocked && !lastFrameLocked)
            {
                scrollReleaseTime = delay;
            }
            lastFrameLocked = scrollingLocked;
    
            if (scrollReleaseTime > 0f)
            {
                scrollReleaseTime -= Time.unscaledDeltaTime;
    
                if (scrollReleaseTime <= 0f)
                {
                    scrollingLocked = false;
                    lastFrameLocked = false;
                }
            }
        }
    
    }
    
  • Sorry for reviving this old thread but I am completely and utterly stuck on this issue and this seems to be the only thread covering this subject.

    My game is also using Direct navigation and as the menus grew bigger and bigger (grid based inventory, objectives etc) I've realized it would make sense if player could continously scroll by pressing and holding directions on keyboard or controller instead of tapping - it just takes so much time to get through them! But no matter what I try - I fail ;)

    I'd appreciate if someone could point me in the right direction ;) (chatGPT failed to do so)

    PS. Tried adding the above script to my GameEngine but it seemed to do nothing at all when I tweaked the values...

  • Tried adding the above script to my GameEngine but it seemed to do nothing at all when I tweaked the values...

    Did you remove the original Player Input component? The script above is a replacement for it.

  • I removed the PlayerInput component and added CustomPlayerInput and... it works!

    Thanks, Chris!!!

    You're the best, as always :)

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.