-
-
Notifications
You must be signed in to change notification settings - Fork 844
feat: SyncVar hooks can have 2, 1 or no params #4077
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
Conversation
@MrGadget1024
MrGadget1024
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syntax changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MrGadget1024
commented
Jan 6, 2026
Not 100% sure if we actually want this for an extra 200 lines of weaver code
It's only ~100 new loc excluding tests (which are great), and if we can deprecate the 2-param signature that will eventually remove almost as much code. Most cases don't need oldValue and newValue is always available in the SyncVar field itself because we always set that before invoking the hook.
Ideally, we should warn for 2-param hooks to advise users to have one param or none, while still allowing two params to compile and work as they do today so there's a transition window for existing projects.
The weaver does this by generating a shim method with 2 params that calls the actual hook method
Not 100% sure if we actually want this for an extra 200 lines of weaver code
Tested with both mono&il2cpp builds (not tested virtual/static hook calls yet, will do if we plan on merging this)