SolidAlloy / ClassTypeReference-for-Unity

Property drawer that allows class selection from drop-down in Unity.
Other
299 stars 38 forks source link

Unity 2022.3.4f1 NullReferenceException: Object reference not set to an instance of an object #43

Open mdmm-git opened 1 year ago

mdmm-git commented 1 year ago

public static class GUIHelper { private static readonly GUIStyle _closeButtonStyle = GUI.skin.FindStyle("ToolbarSeachCancelButton");

    [PublicAPI] public static bool CloseButton(Rect buttonRect)
    {
        return GUI.Button(buttonRect, GUIContent.none, _closeButtonStyle);
        //NullReferenceException: Object reference not set to an instance of an object
    }

}

lorenblue commented 1 year ago

Not sure what exactly this is referring to, but I will say that with Unity 2022 I get a stream of null reference exceptions as well, and this package is unusable.

mdmm-git commented 1 year ago

Not sure what exactly this is referring to, but I will say that with Unity 2022 I get a stream of null reference exceptions as well, and this package is unusable.

Apparently newer versions of Unity are missing some of the styles used here. For example:

public static GUIStyle SearchToolbarStyle =>. _searchToolbarStyle ?? (_searchToolbarStyle = new GUIStyle(GUI.skin.FindStyle("ToolbarSeachTextField"))));

CuteRogue commented 1 year ago

apparently unity change the style its typo one to fixed one (Seach to Search) based on this thread https://forum.unity.com/threads/unable-to-use-input-system-panel.1450204/#post-9140920

mdmm-git commented 1 year ago

apparently unity change the style its typo one to fixed one (Seach to Search) based on this thread https://forum.unity.com/threads/unable-to-use-input-system-panel.1450204/#post-9140920

Thanks! I didn't notice the typo, as Rider doesn't have highlighting for packages integrated via Package Manager -> Git. I'll upload a fork with the fix.

nehvaleem commented 12 months ago

happening to me too. its easily fixable using the custom package, but it isn't the point of maintained packages I think.

LoupAndSnoop commented 10 months ago

Just to help anyone also struggling with this, it is only a problem if you have >10 types being searched, because that makes SolidAlloy use the extended search bar. Workaround: ProjectSettings > Packages > TypeReferences > Search bar minimum items count. Change that from 10 to 99999, and it will stop trying to bring up the SolidAlloy search bar (which I believe just references broken Unity scripts...).

mushakushi commented 3 months ago

+1