Forum rules - please read before posting.

Inventory Issue on Consoles (New Unity Input System)

edited November 2024 in Technical Q&A

I'm in the process of porting my game to all consoles (Nintendo Switch, Xbox, Playstation 4 and 5) and we're just trying to tidy up the last few bugs. At the moment, there is an issue with the inventory. Take a look at this unlisted video here:

Watch the cursor and the item description. You'll see it act normally at the end of the video, but at the beginning you'll see the "Metal Rod" is selected and as it moves over the other items it says "Statue Arm" which is the item directly to the left of the Metal Rod. So, it's like the the cursor (which has become the selected item) isn't registering when it's hovering over the other items. This doesn't always happen, but it happens occasionally.

Here are the Inventory Settings:



I wonder if this is like a update() issue or a fixed update () issue in how the hover overlay works. Maybe not. But what could the issue be here? Where should I start looking? Any thoughts would be greatly appreciated!

On a similar note -- on the rarest of button presses, when you press the B button to select an inventory item, it will open the Journal, which only opens with the R button! Super weird. Doesn't happen on desktop or mobile, but our console Unity project is using the New Unity Input system... regardless, I'm still unsure how one button press can register as another button press. While rarely happened, I have reproduced it and so has the porting team. Any thoughts here are appreciated as well. Thanks!

Comments

  • My EventSystem prefab settings may be pertinent here:

  • Is the label that shows the item's name in a Menu that's underneath the Inventory in the Menu Manager? The order listed affects the order they're processsed in.

    Are you using a simulated cursor to hover over elements? The Input System integration currently has issues when it comes the use of a simulated cursor with Unity UI. These will be ironed out in v1.82 - you're welcome to PM me if you'd like to be involved with testing.

  • edited November 2024

    Thank you for the response. Good questions -- let's see here:

    First of all, I wanted to be clear that it's not just an issue with the Hotspot text (item description). It's like the cursor is actually over the Inventory Item button that the Hotspot text is indicating. For example, dragging the Metal Rod over the Pulley leads to a combine action. But if the Metal Rod is over the Pulley, but the Hotspot text says it's the Statue Arm, it will trigger the Metal Rod with the Statue Arm action.

    About the Hotspot text .... the Hotspot UI (used for the Item Description) is lower in the Menu Manager (below/underneath) the Inventory UI. If I move the Hotspot UI above the Inventory UI in the Menu Manager, it won't render the text. Even if I manually turn it on in the game hierarchy while the game plays in the editor, it still won't render. So, I guess I have to leave the Hotspot UI below the Inventory UI.

    But I believe you are correct that it's the simulated cursor -- let me add that I have written the following script:

    Cursor Rendering: Software

    So, I guess that's simulated. Now, I have this script attached to a slider in my Options menu:

    using UnityEngine;
    using UnityEngine.UI;
    
    namespace AC
    {
        public class CursorSensitivitySettings : MonoBehaviour
        {
        public Slider sensitivitySlider;
        public float maxSensitivityMultiplier = 2.0f;
    
        void Start()
        {
            if (sensitivitySlider != null)
            {
                sensitivitySlider.maxValue *= maxSensitivityMultiplier;
                sensitivitySlider.value = AC.KickStarter.settingsManager.simulatedCursorMoveSpeed;
                sensitivitySlider.onValueChanged.AddListener(UpdateCursorSensitivity);
            }
        }
    
        public void UpdateCursorSensitivity(float newSensitivity)
        {
            if (AC.KickStarter.playerInput != null)
            {
                AC.KickStarter.settingsManager.simulatedCursorMoveSpeed = newSensitivity;
            }
        }
    
        void OnDestroy()
        {
            if (sensitivitySlider != null)
            {
                sensitivitySlider.onValueChanged.RemoveListener(UpdateCursorSensitivity);
            }
        }
    
        }
    }
    

    It's clear that this script allows the user to adjust the Cursor Sensitivity, or the cursor speed. I actually have the maxSensitivityMultiplier set to 8 on the component attached to the slider... this allows for very quick movement if the player desires.

    I mention this because, when the set the maxSensitivityMultiplier really low, like 1.59999, then the issue with the Inventory stops. But when it's set to something more reasonable, like 3.9999 then the Inventory issue starts again.

    Since I'm so close to launching on console, I hesitate to update AC. Is there anything you see here that we could change? I wonder if it's how the simulated cursor is updating what it's rendering over... ? What do you think?

  • The first thing to do is to determine the cause - with the main focus being on the input system.

    I'll PM you a WIP package for v1.82 along with the updated Input System integration. Import these into a duplicate project / separate branch and see if it resolves the issue.

  • edited November 2024

    Coming back to this -- I resolved the issue!

    First of all, I appreciate your PMing me and sending those packages. We actually installed them on a new branch and it ended up breaking a whole bunch of things... but I don't think it was anything wrong with the packages. We've probably just made so many tweaks here and there that the update broke things.

    But this was the issue: the Inventory Item Buttons in the Inventory panel (and a few other buttons) had navigation set up between them. Unity UI buttons are set to Navigate to "Automatic" by default. While my Main Menu and Pause menus are set to navigate directly... the Inventory menu should not be. So, I changed all the Inventory Item buttons' "Navigation" to "None". This resolved the issue.

    Apparently, moving the simulated cursor using the Left or Right gamepad sticks would confuse the input system and it would try to simultaneously move the cursor AND navigate between any buttons with navigation. Not ideal (I figured this out after I realized using the mouse didn't cause an issue).

    I really appreciate you getting back with me twice about this, and I hope this helps any future documentation, troubleshooting, or anyone else who may stumble across this:

    Bottom-line: if you are using a simulated cursor and gamepad, and that cursor is visible on the screen, make sure all Unity UI buttons' Navigation is set to "None". The only time the "Navigation" should be set up between buttons is when the cursor is turned off or the game is paused.

    Thanks again!

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.