yasirkula / UnitySimpleFileBrowser

A uGUI based runtime file browser for Unity 3D (draggable and resizable)
MIT License
849 stars 111 forks source link

VR Pointer issue when selecting items in File Browser (Oculus/Meta Quest 2) #83

Closed apvBri closed 1 year ago

apvBri commented 1 year ago

I'm having an issue where I can't select items inside of the SimpleFileBrowser window.

I looked at the Issue#22 thread and incorporated some changes to my ListItem.cs and FileBrowserItem.cs. Just a note, the latest version of the FileBrowserItem.cs script from UnityAsset store had platform directives at the top of the script telling it to define which pointers for which platform. I removed the ones from the top of the script because I suspect they might be conflicting with the OVR Pointers.

In spite of doing this, I still can't select the "Browse" drive inside of the file window.

yasirkula commented 1 year ago

Hmm, it's actually possible that the "Browse..." button is getting clicked but it doesn't work and doesn't provide visual feedback. For example, inside FileBrowserItem.OnPointerClick function, can you call nameText.enabled = false; and see if clicking "Browse..." hides its text? If that's the case, can you check logcat for error messages when clicking the "Browse..." button?

apvBri commented 1 year ago

Hi, I tried your code snippet and it doesn't hide the "Browse" text in the file window.

public void OnPointerClick(PointerEventData eventData) {

if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL || UNITY_WSA || UNITY_WSA_10_0

        if (eventData.button == PointerEventData.InputButton.Middle)
            return;
        else if (eventData.button == PointerEventData.InputButton.Right)
        {
            // First, select the item
            if (!isSelected)
            {
                prevClickTime = 0f;
                fileBrowser.OnItemSelected(this, false);
            }

//Then, show the context menu fileBrowser.OnContextMenuTriggered(eventData.position); return; }

endif

        //test what happens if clicking "Browse" button
        nameText.enabled = false;
        //
        if (Time.realtimeSinceStartup - prevClickTime < DOUBLE_CLICK_TIME)
        {
            prevClickTime = 0f;
            fileBrowser.OnItemSelected(this, true);
        }
        else
        {
            prevClickTime = Time.realtimeSinceStartup;
            fileBrowser.OnItemSelected(this, false);
        }
    }
yasirkula commented 1 year ago

Did you see any logs at all when pressing the Browse... button?

apvBri commented 1 year ago

Did you see any logs at all when pressing the Browse... button?

A lot of logs passed by, but I couldn't tell what to look for. As I pressed "Browse", I couldn't pick out anything particular or that looked relevant. I tried copying the feed from my Command Prompt into a Notepad file and searching for "error" and I found tracking errors, but nothing that looked relevant.

yasirkula commented 1 year ago

Which VR input plugin are you using? If you put a UI-Button inside SimpleFileBrowserCanvas, can you press it?

apvBri commented 1 year ago

Which VR input plugin are you using? If you put a UI-Button inside SimpleFileBrowserCanvas, can you press it?

I'm using the Oculus/OVR Input plugin.

As for buttons:

It depends. If A button is on the left side of the page (like for the "Test 1" button below), then the button doesn't register. But the button on the right side of the file browser window ("Test 2") works.

SmartSelect_20230714_082438_Meta Quest

But if I move both buttons to the right side of the window, they work.

SmartSelect_20230714_082446_Meta Quest

yasirkula commented 1 year ago

That's super strange, some UI element might be eating all inputs including "Browse..."s input. Maybe this UI object or an invisible UI object:

image

Can you move the FileBrowser to some other location via its title bar (drag&drop) and try again? I hope this works.

apvBri commented 1 year ago

That's super strange, some UI element might be eating all inputs including "Browse..."s input. Maybe this UI object or an invisible UI object:

image

Can you move the FileBrowser to some other location via its title bar (drag&drop) and try again? I hope this works.

Actually, I got it working. It was as simple as the SimpleFileBrowserWindow's RecTransform values being shaped too small for the active area. I must have changed the size of the canvas at some point.

Thanks a lot!