Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work in Unity 2022.2.8 #4

Open
seannowotny opened this issue Mar 16, 2023 · 1 comment
Open

Doesn't work in Unity 2022.2.8 #4

seannowotny opened this issue Mar 16, 2023 · 1 comment

Comments

@seannowotny
Copy link

In FavouritesTreeView.cs this line results in an exception.

PropertyInfo prop = asm.GetType("UnityEditorInternal.EditorResourcesUtility").GetProperty("folderIconName", (BindingFlags.Static | BindingFlags.Public));

NullReferenceException: Object reference not set to an instance of an object FavouritesEd.FavouritesTreeView.FolderIconName () (at Assets/Favourites/Editor/FavouritesTreeView.cs:296) FavouritesEd.FavouritesTreeView.LoadAndUpdate (FavouritesEd.FavouritesAsset favsAsset) (at Assets/Favourites/Editor/FavouritesTreeView.cs:52) FavouritesEd.FavouritesEdWindow.UpdateTreeview () (at Assets/Favourites/Editor/FavouritesEdWindow.cs:59) FavouritesEd.FavouritesEdWindow.AddCategory (FavouritesEd.TextInputWindow wiz) (at Assets/Favourites/Editor/FavouritesEdWindow.cs:103) FavouritesEd.TextInputWindow.Update () (at Assets/Favourites/Editor/TextInputWindow.cs:35) UnityEditor.HostView.SendUpdate () (at <3d77f9e52a364b2f825fba70966192a5>:0) UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <3d77f9e52a364b2f825fba70966192a5>:0)

@luty4ng
Copy link

luty4ng commented Jan 18, 2024

Try this

private static string FolderIconName()
{
#if UNITY_2018_3_OR_NEWER
	return UnityEditor.Experimental.EditorResources.iconsPath;
#else
	if (Invoke_folderIconName == null)
	{
		Assembly asm = Assembly.GetAssembly(typeof(Editor));
		PropertyInfo prop = asm.GetType("UnityEditorInternal.EditorResourcesUtility").GetProperty("folderIconName", (BindingFlags.Static | BindingFlags.Public));
		MethodInfo method = prop.GetGetMethod(true);
		Invoke_folderIconName = (System.Func<string>)System.Delegate.CreateDelegate(typeof(System.Func<string>), method);
	}
	return Invoke_folderIconName();
#endif
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants