-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
ConditionalFieldAttribute is rather slow #240
Comments
I feel a rebellious spirit in you 😁 Btw, what's the other solution you have in mind? We're also searching for alternatives in our studio, although will probably stick with the 2023 version of Unity for a few more years |
Hehe. I guess last weeks made Unity shortcomings even more annoying :) Hmm.. i was thinking about switching to Odin inspector, even though it may end up costing more in the future. But they plan to release a Standalone Version and also Godot Version of their editor. I hacked something together (really just try and error) and used the DrawIf Script i found on the Unity Forum and merged it with your scripts. It seems to work on complex structures. Only part were a workaround is needed (i think same in the original):
If you check on multiple enums -> I think in your script _toShow = ConditionalUtility.IsPropertyConditionMatch(property, conditional.Data); makes it slow. Since Unitys FindProperty is just bad. I cache those properties on first selection of the GameObject and then clear the dictionaries afterwards. Btw this feels more like putting duct tape on a crashed car, since rest of unitys code is slow. `[CustomPropertyDrawer(typeof(DrawIfAttribute))]
}` It also has a static DrawIf class (just so naming is convinient), that holds the caches `#if UNITY_EDITOR
#endif The Attribute: `[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
}`
`[InitializeOnLoad]
}` |
Yeah, ConditionalField was pretty simple and fast once, but now there is a lot going on under the hood. I got to make lots of tweaks to support nested inspectors, inheritance, and a bunch of other edge cases. Now it is a really clumsy bunch of code and I had no chance to dig into optimization 🤔 |
Hey i just wrote a complex editor script with lots of lists and other things and the ConditionalFieldAttribute is really slow.
I guess there cant be much done about it, since unitys editor script is slow.
So basically.. we need to get rid of unitys editor and switch to a other solution.
The text was updated successfully, but these errors were encountered: