Skip to content

Meta Quest dialog closing #59

Open

Description

@JuanIrache

Description of the bug

Hi. I installed the plugin a few weeks ago and it was running well on a Meta Quest 3. Recently something changed and the file picking dialog is closing immediately after I try to open it. I reverted to my code version when it was working well and the problem persists, so my hypothesis is that some update on the Meta Quest 3 broke this. Sometimes a window frame titled "Frame resolver" becomes visible. If I click my file picking button repeatedly sometimes the app goes into pause and the Meta UI shows the file picking dialog, but picking a file doesn't have any effect. The same is happening with UnitySimpleFileBrowser. Am I the only one experiencing this?

Reproduction steps

Opening a file picking dialog.

Platform specs

  • Unity version: 6000.0.43f1
  • Platform: Android
  • Device: Meta Quest 3
  • How did you download the plugin: git cloned and copied Plugins

Thanks

Activity

  1. yasirkula commented on Apr 3, 2025

    @yasirkula
    Owner

    I've never heard this plugin working well on Quest. If there is a solution, it requires me to iterate on this in quick succession and that's not possible without a headset of mine. Though UnitySimpleFileBrowser is supposed to work fine. If you're seeing the "Browse..." button, please check out that plugin's FAQ for Quest-related entry.

  2. JuanIrache commented on Apr 3, 2025

    @JuanIrache
    Author

    Thanks for your reply. Interestingly UnityNativeFilePicker was working well until a few days ago, now both plugins fail. They just flash a screen very briefly. I don't see a browse button. I will investigate a bit more.

  3. yasirkula commented on Apr 4, 2025

    @yasirkula
    Owner

    Hmm, that's strange. If SimpleFileBrowser isn't up-to-date, can you try updating it? I can think of two possibilities: either synchronous permission dialog is causing this (it's made asynchronous in the latest update) or the permission dialog itself is causing this (you can disable it via FileBrowser.AskPermissions=false).

  4. JuanIrache commented on Apr 4, 2025

    @JuanIrache
    Author

    I just downloaded the plugin yesterday. Disabling it the permission dialog doesn't seem to make a difference. I have recorded the problem ( https://youtube.com/shorts/nWRoVeH-6sg ), and by pausing it in the right frame you can see that the window that flashes briefly is not the file picking dialog, but the app pause screen, so it looks like the headset is pausing and unpausing the app quickly when the file picker tries to load

  5. yasirkula commented on Apr 4, 2025

    @yasirkula
    Owner

    I'm expecting issues in this plugin but not on SimpleFileBrowser, especially when AskPermissions is set to false. Because no native code will be executed at that point. Though gotta admit that it's the first time I've heard about issues in AskPermissions.

  6. JuanIrache commented on Apr 4, 2025

    @JuanIrache
    Author

    I reverted to an old version of Unity and started a blank Core VR project. Same problem. I strongly suspect this is related to some recent update on the Quest, but strangely I can't find related issues anywhere

  7. thormj commented on Jun 21, 2026

    @thormj

    I don't know if this helps or is a different issue...
    on my Q3... it all works... until you click the file.

    It seems to have crashed to desktop, but it's still there and did do the things... but you can only see that if you take the headset off and put it back on again... Was working okay about a month ago... but I have no idea when or what broke it...

  8. yasirkula commented on Jun 22, 2026

    @yasirkula
    Owner

    @thormj Can you test if NativeFilePicker.PickFile's callback function or Unity's OnApplicationPause/OnApplicationFocus functions are invoked before we seemingly crash to desktop? If possible, you can log DateTime.Now in those functions and use logcat to read them.

  9. thormj commented on Jun 22, 2026

    @thormj

    Hopefully this isn't cut too much....

    My code:

            Debug.Log($"!!NFP...{DateTime.Now}");
            NativeFilePicker.PickFile((zpath) =>
            {
                Debug.Log($"!!NFP... Back {DateTime.Now}");
    
                HUD.Viz.PopBusy();
                if (zpath == null)
                    Debug.Log("Operation cancelled");
                else
                {
                    Debug.Log($"LoadPhoto '{zpath}'");
    

    ...

        void OnApplicationFocus(bool hasFocus)
        {
            Debug.Log($"!!Focus changed to {hasFocus} at {DateTime.Now}");
        }
    
        void OnApplicationPause(bool pauseStatus)
        {
            Debug.Log($"!!Pause changed to {pauseStatus} at {DateTime.Now}");
        }
    

    And I have a

    OVRManager.InputFocusAcquired += SyncHeight;
    ...
        void SyncHeight()
        {
            var pos = transform.localPosition;
            pos.y = Camera.main.transform.position.y;
            transform.localPosition = pos;
            Debug.Log($"[VHT] SyncHeight: `{pos.y}`");
        }
    
    

    --
    **** Below is where it was "just sitting at the desktop... and I took the Q3 off and put it back on again.
    Logcat, very filtered, very trimmed (let me know if you want less trimmed and I'll attach one -- the whole logcat is 3MB or so]
    Initial trim done with type nfp.log | grep -v "libunity.so" | grep -v "libil2cpp.so" | grep -v "[XR]" and then a bunch of manual trimming.
    :

    --------- beginning of main

    06-22 12:26:45.318 27672 27672 V Unity   : Context Type: GameActivity
    06-22 12:26:45.322 27672 27704 I Unity   : UnityApplication::CreateInstance
    06-22 12:26:45.322 27672 27704 I Unity   : GameActivity Package Version '3.0.5'
    06-22 12:26:45.323 27672 27704 I Unity   : Starting Game Loop
    06-22 12:26:45.342 27672 27704 I Unity   : Handle cmd APP_CMD_GAINED_FOCUS(7)
    06-22 12:26:45.342 27672 27704 I Unity   : Handle cmd APP_CMD_LOST_FOCUS(8)
    06-22 12:26:45.343 27672 27704 I Unity   : Handle cmd APP_CMD_WINDOW_INSETS_CHANGED(17)
    06-22 12:26:45.348 27672 27704 I Unity   : Handle cmd APP_CMD_WINDOW_INSETS_CHANGED(17)
    06-22 12:26:45.349 27672 27704 I Unity   : Handle cmd APP_CMD_WINDOW_INSETS_CHANGED(17)
    06-22 12:26:45.349 27672 27704 I Unity   : Handle cmd APP_CMD_WINDOW_INSETS_CHANGED(17)
    06-22 12:26:45.350 27672 27704 I Unity   : Handle cmd APP_CMD_INIT_WINDOW(1)
    06-22 12:26:45.355 27672 27704 I Unity   : MemoryManager: Using 'Dynamic Heap' Allocator.
    06-22 12:26:45.405 27672 27704 I Unity   : ApplicationInfo 'com.ATL3D.MrTestMk2', Version '0.1.0', Min API Level '32', Target API Level '34'
    06-22 12:26:45.405 27672 27704 I Unity   : Device Model 'Oculus Quest 3', OS 'Android OS 14 (API 34)'
    06-22 12:26:47.799 27672 27704 I Unity   :  #12 0x7c787e10c8 (libgame.so) Unity::UnityApplication::OnApplicationCommand(android_app*, int) 0x308
    06-22 12:26:47.799 27672 27704 I Unity   :  #13 0x7c787ea85c (libgame.so) ? 0x0
    06-22 12:26:47.799 27672 27704 I Unity   :  #14 0x7c787e175c (libgame.so) Unity::UnityApplication::Loop() 0xe0
    06-22 12:26:47.799 27672 27704 I Unity   :  #15 0x7c787e3b2c (libgame.so) MainLoop(android_app*) 0x3c
    06-22 12:26:47.799 27672 27704 I Unity   :  #16 0x7c787e3bc4 (libgame.so) android_main 0x64
    06-22 12:26:47.799 27672 27704 I Unity   :  #17 0x7c787ea730 (libgame.so) ? 0x0
    06-22 12:26:47.799 27672 27704 I Unity   :  #18 0x7d82f290ac (libc.so) __pthread_start(void*) 0xcc
    06-22 12:26:47.799 27672 27704 I Unity   :  #19 0x7d82ec0f70 (libc.so) __start_thread 0x40
    06-22 12:26:47.799 27672 27704 I Unity   : 
    ...[trimmed]...
    06-22 12:27:11.768 27672 27704 I Unity   : [VHT] SyncHeight: `1.742293`
    06-22 12:27:16.323 27672 27704 I Unity   : !!Pause changed to True at 6/22/2026 12:27:16 PM
    06-22 12:27:16.360 27672 27704 I Unity   : !!Pause changed to False at 6/22/2026 12:27:16 PM
    06-22 12:27:16.577 27672 27704 I Unity   : [VHT] SyncHeight: `1.739413`
    06-22 12:27:18.855 27672 27704 I Unity   : OnLoad Clicked
    06-22 12:27:18.855 27672 27704 I Unity   : !!NFP...6/22/2026 12:27:18 PM
    06-22 12:27:18.862 27672 27704 I Unity   : StateChanged: Load... - True
    06-22 12:27:20.047 27672 27704 I Unity   : Handle cmd APP_CMD_LOST_FOCUS(8)
    06-22 12:27:20.051 27672 27704 I Unity   : !!Focus changed to False at 6/22/2026 12:27:20 PM
    
    06-22 12:27:28.326 27672 27704 I Unity   : Handle cmd APP_CMD_PAUSE(14)
    06-22 12:27:28.328 27672 28588 D Unity   : Selected media uri: content://com.android.providers.downloads.documents/document/msf%3A1000001585
    06-22 12:27:28.363 27672 28588 D Unity   : Copied media from content://com.android.providers.downloads.documents/document/msf%3A1000001585 to: /storage/emulated/0/Android/data/com.ATL3D.MrTestMk2/cache/FireBird - 20210731_140911-Cropped.jpg
    06-22 12:27:28.377 27672 27704 I Unity   : !!Pause changed to True at 6/22/2026 12:27:28 PM
    06-22 12:27:34.849 27672 27704 I Unity   : !!Pause changed to False at 6/22/2026 12:27:34 PM
    06-22 12:27:34.890 27672 27704 I Unity   : !!Focus changed to True at 6/22/2026 12:27:34 PM
    06-22 12:27:34.984 27672 27704 I Unity   : !!NFP... Back 6/22/2026 12:27:34 PM
    06-22 12:27:34.984 27672 27704 I Unity   : LoadPhoto '/storage/emulated/0/Android/data/com.ATL3D.MrTestMk2/cache/FireBird - 20210731_140911-Cropped.jpg'
    06-22 12:27:35.031 27672 27704 I Unity   : Set: [FileName] = '/storage/emulated/0/Android/data/com.ATL3D.MrTestMk2/cache/FireBird - 20210731_140911-Cropped.jpg'
    06-22 12:27:35.101 27672 27704 I Unity   : PhotoDone.
    06-22 12:27:35.248 27672 27704 I Unity   : [VHT] SyncHeight: `1.671996`
    06-22 12:27:37.355 27672 27704 I Unity   : !!Focus changed to False at 6/22/2026 12:27:37 PM
    06-22 12:27:45.294 27672 27704 I Unity   : Handle cmd APP_CMD_GAINED_FOCUS(7)
    [****- I think this is where I briefly took the Q3 off and put it back on; then Unity came back and my picture was loaded]
    06-22 12:27:45.297 27672 27704 I Unity   : !!Focus changed to True at 6/22/2026 12:27:45 PM
    06-22 12:27:45.306 27672 27704 I Unity   : [VHT] SyncHeight: `1.748589`
    06-22 12:27:48.559 27672 27704 I Unity   : Look rotation viewing vector is zero
    06-22 12:27:48.588 27672 27704 I Unity   : Look rotation viewing vector is zero
    06-22 12:28:03.933 27672 27704 I Unity   : Handle cmd APP_CMD_LOST_FOCUS(8)
    06-22 12:28:03.936 27672 27704 I Unity   : !!Focus changed to False at 6/22/2026 12:28:03 PM
    06-22 12:28:04.078 27672 27704 I Unity   : Handle cmd APP_CMD_GAINED_FOCUS(7)
    06-22 12:28:04.081 27672 27704 I Unity   : !!Focus changed to True at 6/22/2026 12:28:04 PM
    06-22 12:28:04.087 27672 27704 I Unity   : Handle cmd APP_CMD_LOST_FOCUS(8)
    06-22 12:28:04.088 27672 27704 I Unity   : !!Focus changed to False at 6/22/2026 12:28:04 PM
    06-22 12:28:06.319 27672 27704 I Unity   : Handle cmd APP_CMD_PAUSE(14)
    06-22 12:28:06.382 27672 27704 I Unity   : !!Pause changed to True at 6/22/2026 12:28:06 PM
    06-22 12:28:06.467 27672 27704 I Unity   : Handle cmd APP_CMD_STOP(15)
    06-22 12:28:06.469 27672 27704 I Unity   : Handle cmd APP_CMD_SAVE_STATE(13)
    06-22 12:28:06.487 27672 27704 I Unity   : UnityApplication::DestroyInstance
    06-22 12:28:06.493 27672 27704 E Unity   :   at HUD.OnApplicationQuit () [0x00000] in <00000000000000000000000000000000>:0 
    06-22 12:28:08.544 27672 27704 W Unity   : Internal: There are remaining Allocations on the JobTempAlloc. This is a leak, and will impact performance
    06-22 12:28:08.544 27672 27704 W Unity   : To Debug, run app with -diag-job-temp-memory-leak-validation cmd line argument. This will output the callstacks of the leaked allocations.
    06-22 12:28:08.556 27672 27704 I Unity   : Quitting process
    
    
  10. yasirkula commented on Jun 22, 2026

    @yasirkula
    Owner

    The Selected media uri line is where you've picked a file. Looking at the timestamps and your description of the issue, I'd guess that the crash actually occurs in between these lines:

    06-22 12:27:28.377 27672 27704 I Unity   : !!Pause changed to True at 6/22/2026 12:27:28 PM
    06-22 12:27:34.849 27672 27704 I Unity   : !!Pause changed to False at 6/22/2026 12:27:34 PM
    

    If that's true, then we actually have a call to OnApplicationPause(true) just before the crash. Can you try calling the RequestVRFocus function from this thread in OnApplicationPause when pauseStatus is true? If it works, then we'll have to tweak it to run only when NativeFilePicker is activated, not for all OnApplicationPause calls.

  11. thormj commented on Jun 23, 2026

    @thormj

    No... it's not a crash (?)
    If I take my headset off and put it back on... it worked and did the load and all.
    Just until I take it off and put it back on... I just see the desktop. Unity... "hasn't come back visible yet."

    I added the RequestVRFocus... and still appeared to disappear. Until I clicked a controller. Then it came "back" but ... still had the background app in place and in front of my Unity UI:

    Image

    I don't remember click-and-it-shows-up working (at all) without the RequestVRFocus.

  12. thormj commented on Jun 24, 2026

    @thormj

    Should I make a new issue... or is this maybe all the same? I threw it here because... like I said, it wasn't a crash per se, but you had to take the headset off and put it on again before your app went visible again.

    I added to Meta's schtick [https://developers.meta.com/horizon/feedback/myreports/2796109420743288/] but you probably can't see that... Says "Received" but nothing else yet...

  13. yasirkula commented on Jun 25, 2026

    @yasirkula
    Owner

    @thormj I'm sorry I couldn't answer due to busy work schedule. Thank you for providing all these details and testing the RequestVRFocus solution. You can create a new Issue but I believe the core problem is the same and when it's fixed, it'll affect both your Issue and this original Issue.

    I currently don't have any other suggestions. The RequestVRFocus suggestion was offered by AI. I actually recommend you to talk with AI as well and quickly iterate different solutions with it because I don't have that luxury without that headset.

  14. yasirkula commented on Jun 27, 2026

    @yasirkula
    Owner

    I've tried another AI suggestion. I've added the following lines to this native code:

    Intent intent = new Intent(getContext(), getContext().getClass());
    intent.addFlags( Intent.FLAG_ACTIVITY_REORDER_TO_FRONT );
    startActivity( intent );
    Log.d( "Unity", "USED FLAG_ACTIVITY_REORDER_TO_FRONT TO BRING UNITY ACTIVITY TO FRONT" );

    If you'd like to test it, you can replace NativeFilePicker.aar with the one inside this zip archive.

  15. thormj commented on Jun 28, 2026

    @thormj

    That WORKED. No flicker no nothing... just pick and load!
    Beautiful man, beautiful.
    Thanks!!!

  16. yasirkula commented on Jun 28, 2026

    @yasirkula
    Owner

    I'm very happy to hear that! I'll make this an official part of the plugin with a configurable setting.

  17. yasirkula commented on Jun 29, 2026

    @yasirkula
    Owner

    @thormj I've made the necessary changes. I'd like to ask you one final test before committing the changes. In the previous test, I had also disabled showProgressbar, just in case. Now, I'd like to see if that was really necessary. Can you update the aar with this one and execute the following C# script in your Awake or Start function:

    #if !UNITY_EDITOR && UNITY_ANDROID
    using( AndroidJavaClass ajc = new AndroidJavaClass( "com.yasirkula.unity.NativeFilePickerPickFragment" ) )
    {
    	ajc.SetStatic<bool>( "forceFocusUnityActivityOnComplete", true );
    	ajc.SetStatic<bool>( "showProgressbar", true );
    }
    #endif

    If that works, then we can conclude that the progressbar has no side effect. Otherwise, please try setting showProgressbar to false instead and try again. That will replicate the exact same state that NativeFilePicker.aar was in in the previous test, so it should be guaranteed to work.

  18. thormj commented on Jun 29, 2026

    @thormj

    Compiling and getting a big enough picture so I might see a progress bar.
    Is there a way that I can call NFP to cache (or whatever) files that I know ought to be there?
    For example... NFP pick the html page, I run thru it and tell nfp to "get these additional files" then I tell Tlabwebview to load the page (yeah, that's odd too)...

    Somehow somewhere the whole file handling on the Q3 is just futzing with my brain. My main app is a json file, but it loads 3mfs and html that were picked (cached?) earlier so it kinda works... until it maybe doesn't. OTOH, saving the kaboodle out to the downloads dir kinda sorta seems to work (though you end up having to browse for it in an odd place)...

  19. yasirkula commented on Jun 29, 2026

    @yasirkula
    Owner

    I think the best you can do is picking a folder rather than a file and then accessing the files inside that folder. NativeFilePicker doesn't support it but SimpleFileBrowser does.

    To clarify, with the latest aar and the C# code I've sent, you've seen a big enough panel with a progressbar in it. After the progressbar disappeared, did the game continue without any interruptions or issues?

  20. thormj commented on Jun 29, 2026

    @thormj

    With the progress bar, it did the same stay in back as the original...
    If I set it to false, it works just as slick as before.

    I tried feeding it a 55MB picture, to see if that would trigger the progress bar, but... saw nothing at all just was in the background until I took the headset off then on again (then I found out that Unity doesn't like panoramic gigapixel texes... error width 6000 is too large).
    But then I turned the progressbar false, it quickly loaded my 3MB picture and also quickly loaded (into black error) the 55MB picture....
    I can try to catch a logcat with it, but... would that be useful?

  21. yasirkula commented on Jun 30, 2026

    @yasirkula
    Owner

    Logcat won't be necessary. Thank you again for testing it. I'll commit the changes and from now on, I'll suggest VR users to set forceFocusUnityActivityOnComplete to true and showProgressbar to false in Awake or Start:

    #if !UNITY_EDITOR && UNITY_ANDROID
    using( AndroidJavaClass ajc = new AndroidJavaClass( "com.yasirkula.unity.NativeFilePickerPickFragment" ) )
    {
    	ajc.SetStatic<bool>( "forceFocusUnityActivityOnComplete", true );
    	ajc.SetStatic<bool>( "showProgressbar", false );
    }
    #endif
  22. yasirkula commented on Jun 30, 2026

    @yasirkula
    Owner

    @JuanIrache If you get the chance, can you also test this fix?

  23. thormj commented on Jul 4, 2026

    @thormj

    Ack. Actually... I also need to do RequestVRFocus(); when I get back from NFP... else I still have to take it off and put it back on. One place I was loading (photos, test case) did that... but the other branches didn't so I was confused when it didn't work...

        private static void RequestVRFocus()
        {
            Debug.Log("FocusRequested");
            try
            {
                AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
                activity.Call("runOnUiThread", new AndroidJavaRunnable(() =>
                {
                    using (AndroidJavaObject window = activity.Call<AndroidJavaObject>("getWindow"))
                    using (AndroidJavaObject decorView = window.Call<AndroidJavaObject>("getDecorView"))
                    {
                        decorView.Call<bool>("requestFocus");
                    }
                }));
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
        }
    
    
  24. thormj commented on Jul 7, 2026

    @thormj

    Ah no. I was bass ackwards.
    Don't do RequestVRFocus

    But Must do ''' private void Awake()
    {
    #if !UNITY_EDITOR && UNITY_ANDROID
    using( AndroidJavaClass ajc = new AndroidJavaClass( "com.yasirkula.unity.NativeFilePickerPickFragment" ) )
    {
    ajc.SetStatic( "forceFocusUnityActivityOnComplete", true );
    ajc.SetStatic( "showProgressbar", false );
    }
    #endif
    }
    '''

    If it screws up... you can fix it by tapping your headset twice to suspend and then click the resume button... Then Unity comes back without extra windows.

  25. yasirkula commented on Jul 7, 2026

    @yasirkula
    Owner

    Then I'm glad I didn't get the chance to include RequestVRFocus in the source code 😄 But I'm sad to hear that the current solution doesn't always work. I'm assuming RequestVRFocus made no difference at all.

  26. thormj commented on Jul 7, 2026

    @thormj

    RequestVRFocus brought it back... but with old desktop apps in the picture.
    If you do that stuff in Awake it smiply works and works well. But [with the version I have] you gotta do that or it stays in the out-to-lunch desktop thing (same manual fix: Star Wars: "Radio Broken" gesture).

    Now I've got all 3 of my load file bits working well (I forgot the awake in two of the more complicated cases -- I was simply testing with a photo-frame object... but I forgot to apply the fixes to scene and object load).

  27. yasirkula commented on Jul 8, 2026

    @yasirkula
    Owner

    Oh OK. In my mind, I was expecting VR users to manually add this code to Awake/Start anyways so all is well in that case. I'll update the documentation to state this manual requirement.

    If it screws up... you can fix it by tapping your headset twice to suspend and then click the resume button

    I'm assuming this has never happened with the Awake fix. PS. It's sufficient to apply the Awake fix only once every gameplay session. Calling it before every NativeFilePicker call is unnecessary.

  28. thormj commented on Jul 9, 2026

    @thormj

    I'm assuming this has never happened with the Awake fix. PS. It's sufficient to apply the Awake fix only once every gameplay session. Calling it before every NativeFilePicker call is unnecessary.

    Correct. I just didn't always do the awake thing because I didn't always "load photo" first...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions