-
Notifications
You must be signed in to change notification settings - Fork 220
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
Calling .remove(func) on a C# static event after a .add(func) makes further .add()'s fail to be called #112
Comments
Using net35 in Unity (4.6.8f1), I should add. |
Event management in MoonSharp is enormously complex, so a bug there is not unlikely ! Will check this asap. (Ideally I want to go 1.0 pretty soon, so I'll try to fix sooner than later!) |
Cool :) For now I can use my work around. Good luck bug hunting. Let me know if you have any trouble reproducing it, if you do then I can try and make a minimal Unity project that exhibits the problem. |
Solved on master (not yet deployed on binaries!) |
Confirmed working using latest src in Unity project. \o/ Thank you :D |
You're welcome :) |
These steps happen in my code (using 0.9.8)...
If I put in a dummy delegate before the above - it all works as expected.
So I think that when I remove the last delegate from the event it somehow resets its state, and for some reason from then on Moonsharp is no longer looking at the same event? As if returning the event it to null actually created a new event object (I'm no C# expert, but it seems that events/delegate do some magic in their null state).
Does this sound plausible?
NOTE: I have previously noticed that I need to Unregister and Register classes with static events in them if I null any of the static events, otherwise they no longer work - this seems like its the same(?) issue.
The text was updated successfully, but these errors were encountered: