SolidAlloy/ClassTypeReference-for-Unity

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

mdmm-git opened this issue · 7 comments

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
    }

}

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.

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"))));

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

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.

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

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...).