yasirkula / UnitySimpleFileBrowser

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

1.6.6 (git) & 2022.3.23f (windows) — Null Reference Exception #97

Closed SergeyBaryshev closed 7 months ago

SergeyBaryshev commented 7 months ago

Simply calling FileBrowser.ShowLoadDialog(...); i got a null reference exception at "FileBrowser.cs":

private static FileBrowser Instance
{
    get
    {
        if( !m_instance )
        {
            m_instance = Instantiate( Resources.Load<GameObject>( "SimpleFileBrowserCanvas" ) ).GetComponent<FileBrowser>();
/* HERE -> */       DontDestroyOnLoad( m_instance.gameObject );
            m_instance.gameObject.SetActive( false );
        }

        return m_instance;
    }
}

Trying debug this i've examine that field "m_instance" is null, because script in this prefab is not found. When i open that prefab in Unity this script on parent gameobject has error and couldn't be loaded (wtf?) Rolling back to 1.6.4 and it works perfect.

P.S. Sorry for my English, it's not my native language.

yasirkula commented 7 months ago

The closest Unity version I have is 2022.3.8f1. I've imported the plugin via unitypackage and via Package Manager and in both scenarios, didn't encounter this issue. I'm guessing that if the same issue occurs, right clicking the SimpleFileBrowserCanvas prefab and selecting Reimport would resolve the issue.

SergeyBaryshev commented 7 months ago

I'm tried reimport, even uninstall and reinstall SFB - same thing. After all I delete my local project and redownload it from github and even reinstall Unity itself. And... it works! So, it was on my end, sorry for convenience.