Forum rules - please read before posting.

Two Fingers Tap to Examine Inventory

Dear Chris,
I'm porting my new game for mobile (iOs and Android) and when I'm playing on mobile, I've set my input method to "Touch Screen". I'm using Point and Click movement, Context Sensitive interaction and I have checked the "Activate Hotspots with double-tap?". I don't have any interaction menu popping out, on PC the left mouse click is "Use", the right mouse click is "Examine", right away.
All works great (I can "use" hotspot with double tap, and "examine" them with two fingers tap, select an inventory item with one finger tap, and deselect it with two fingers tap), except that I cannot examine inventory items.
As soon as I select them (tap on top of an item in my inventory, doesn't matter if with one or two fingers) it triggers the "Use" (which for 90% of my items is selecting it to use it within the scene).
Basically, I cannot figure out a way to examine inventory items on a touch screen (mobile).
Any hints? Workarounds? Suggestions?

Comments

  • What are your AC and Unity versions, and can you share an image of your Settings Manager?

    You could rely on custom scripting to detect two fingers over an inventory, but an alternative would be to rely on the Can drop an Item onto itself to Examine it? / Clicking an Item without dragging Examines it? options.

    These both require the Drag and drop Inventory interface? option to be checked, with the latter also needing a non-zero Drag threshold value.

  • Thanks for your reply.
    Unity 2021.3.24f1
    AC v1.76.1

    My inventory is not Drag and Drop but maybe I can change it at runtime when on Mobile platforms. I'll need to do some tests in that sense, but I think I know how to code that.

    If the Drag and Drop solutions don't work or are not what I'm looking for, do you have any guidance about the custom script for the enabling the two fingers over an inventory? Please also consider I'm using Rewired for handling my inputs (even if the "touch" so far was basically a mouse simulation).

    Regards
    N.

  • A two-finger tap on mobile should register as a right-click. Rewired may not be communicating this to AC, however. If drag-and-drop doesn't work, test the behaviour without the involvement of Rewired to pinpoint the issue.

  • edited June 2023

    Uhm, ok, thanks. I will try. Two fingers tap indeed works as a right click on every other circumstance (deselect item, examine hotspots, etc.) but not on examine Inventory, as described on my first post.
    But I'll check with Rewired if somehow that's preventing stuff on Inventory, but it sounds strange if it does work for the other cases... (maybe because Inventory is UI and relies on Event System?)

  • This may be an issue specific to Unity UI-based menus.

    Open up AC's UISlotClickRight script, and replace its Update function with:

    private void Update ()
    {
        if (menuElement)
        {
            if (KickStarter.playerInput && KickStarter.playerInput.InputGetButtonDown ("InteractionB"))
            {
                if (KickStarter.playerMenus.IsEventSystemSelectingObject (gameObject))
                {
                    menuElement.ProcessClick (menu, slot, MouseState.RightClick);
                    return;
                }
            }
    
            if (KickStarter.settingsManager.inputMethod == InputMethod.TouchScreen && KickStarter.playerInput && KickStarter.playerInput.InputTouchCount () == 2 && KickStarter.playerInput.InputTouchPhase (1) == TouchPhase.Began)
            {
                if (KickStarter.playerMenus.IsEventSystemSelectingObject (gameObject))
                {
                    menuElement.ProcessClick (menu, slot, MouseState.RightClick);
                }
            }
        }
    }
    

    Does that resolve it?

  • I get compiling errors:
    InputTouchCount and InputTouchPhase are inaccessible due to their protection level.
    And "TouchPhase" does not exist.
    is it due to my AC version? (see it above)

  • No - make them public in PlayerInput. I'll do the same officially if the test is successful.

    Replace TouchPhase with UnityEngine.TouchPhase.

  • Looks like it works now, thanks!

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.