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

EditorLayout.SearchTextField() method NullReferenceException #2

Closed
lightjiao opened this issue Jul 16, 2023 · 5 comments
Closed

EditorLayout.SearchTextField() method NullReferenceException #2

lightjiao opened this issue Jul 16, 2023 · 5 comments
Labels
duplicate This issue or pull request already exists

Comments

@lightjiao
Copy link

lightjiao commented Jul 16, 2023

Describe the bug
EditorLayout.SearchTextField() method has code like below:

if (GUILayout.Button(string.Empty, GUI.skin.FindStyle("ToolbarSeachCancelButton")))

but there is no *.guiskin file, GUI.skin.FindStyle("ToolbarSeachCancelButton") will return null, then cause NullReferenceException

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.GUILayoutUtility.DoGetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
UnityEngine.GUILayoutUtility.GetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
UnityEngine.GUILayout.DoTextField (System.String text, System.Int32 maxLength, System.Boolean multiline, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)
UnityEngine.GUILayout.TextField (System.String text, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <82a3a4e0a0a94de5afddd345f6cf50d1>:0)

I use Entitas.Generic instead code generator ( more conviance with little performance price )
I don't find any *.guiskin in source code, can you help me to solve the problem?

*Unity Version: 2022.3.4f1 and 2021.3.28f1

@lightjiao lightjiao reopened this Jul 17, 2023
@sschmid sschmid added the duplicate This issue or pull request already exists label Jul 17, 2023
@sschmid
Copy link
Owner

sschmid commented Jul 17, 2023

@lightjiao See this issue for and updated dll that fixes this:
sschmid/Entitas#1067 (comment)

@sschmid
Copy link
Owner

sschmid commented Jul 17, 2023

I just checked the Entitas repo you linked and it hasn't been updated in many years. Please try the dll I linked in the issue, but there's a chance it's not compatible anymore because the repo is so old.

Alternatively, try using Unity Version 2022.3.2f1. I think Unity introduced this breaking change in 2022.3.3 or 2022.3.4

@sschmid
Copy link
Owner

sschmid commented Jul 17, 2023

If it doesn't work, I can try to provide a fixed version of the old DesperateDevs dll for you

@lightjiao
Copy link
Author

It solve my problem perfectly, thanks a lot.

by the way, the Entitas.Generic repo only use the core API of entitas, it is very simple and easy to use. I simplified it's API, looks good for me.

@JesseTG
Copy link

JesseTG commented Jul 25, 2023

Could you put out a new release of this repo that includes the fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants