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

Reflection types, methods, fields and properties should be looked up in static constructors #126

Open
DorCoMaNdO opened this issue Feb 20, 2025 · 0 comments

Comments

@DorCoMaNdO
Copy link
Contributor

Issues such as #121 are caused by reflection lookups failing, but since these lookups are only (re)performed when the execution of a feature requires them, it makes things harder to debug, especially since there's no error checking/logging for these lookups, it is also slower to use reflection over and over.

Performing all lookups in a static constructor that does error checking (ex: type != null before attempting to lookup fields, printing an error with the lookup target when null) will help address Unity/dependency incompatibilities faster by printing the error on load rather than on feature use, eliminating the need to test every reflection-dependent feature individually and will also speed up execution, which may have considerable improvement for some GUI-based events.

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

1 participant