-
Notifications
You must be signed in to change notification settings - Fork 103
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
Static fields in changed code are lost upon reload #110
Labels
feature
New feature or request
Comments
handzlikchris
changed the title
Static fields are lost upon reload
Static fields in changed code are lost upon reload
Nov 20, 2023
Hi - yes it'll be a limitation. When reload happens your new code is technically in class/new assembly with changed name. Static values are not reinitialized. I'll leave this one open as it's possible to reinitialize those on reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am not sure whether this is expected behaviour or not, but I could not find any reference in the documentation to static fields not being supported.
I am trying to reload a static class that has a static
Material
field that is assigned on startup via reflection.The static class content looks like this:
After changing the contents of DrawReticleCircle, the script is reloaded but the value of
material
is lost.The debug log reads:
Post-reload, asset is (null=True)
I would expect for the value to be copied over, or for the new code to reference the field in the old assembly (if this is possible?).
Is this a known limitation or a bug? If it is a limitation, I think it is worth pointing out in the documentation.
Thanks.
The text was updated successfully, but these errors were encountered: