keiwando / nativefileso

Unity - Native file dialogs and file type associations on Windows, macOS, iOS and Android
Mozilla Public License 2.0
92 stars 11 forks source link

Excellent work, can we avoid app restart on file open? #4

Open bhupiister opened 3 years ago

bhupiister commented 3 years ago

Hi, first of all thanks for sharing your project. Excellent work done by you. I can open custom files with my app now. The only downside I feel is the app restart when opening a file from outside. I know it's the intended behaviour as per the limitations written by you. Can this be avoided anyhow?

keiwando commented 3 years ago

I at least didn't manage to find a way to make it work without it causing an entire app restart.

bhupiister commented 3 years ago

@keiwando I later realised, it was more easy to handle file open when app restarts. Now I am missing this thing on IOS, is there some way to restart app on IOS as well?

keiwando commented 3 years ago

No, I don't think there is a way to force it to do that. Even if there was, it wouldn't be something that I would add to this plugin. Not having the entire app restart is the desired behaviour, so it's currently just the Android version that needs to be fixed.

bhupiister commented 3 years ago

@keiwando I get it, but what if I am on some other scene and select the downloaded file from the notification window and open it. Is there some way to change the scene to the first one and proceed with the file open? Is there some way to do it in the plugin or I need to programme it?

keiwando commented 3 years ago

If you want to change the scene when a file is opened from outside of the app, you need to do it manually. Only you know whether and how to change between different scenes in you app (maybe you want to save some progress before going back to the first scene or maybe you don't want to go back at all etc.).

You can also always process the opened file in the current scene that you're in via the delegate callbacks.