Draft
Conversation
1f9813c to
a4b2eb9
Compare
Author
|
@RevenantX would do you thinks about this? I know that you can subscribe with bind to value type changes, but I tried to make it easier for devs. For Sync Fields I coudn't find a way for change notifications in the current codebase. |
- Implemented `ISyncFieldChanged<T>` interface for syncable fields to handle value changes. - Added `ValueChanged` event in relevant classes to notify when values change. - Updated methods to include field names in processing for better tracking. - Introduced a callback registry to manage and invoke user-defined callbacks on type value changes.
a4b2eb9 to
80ab25b
Compare
Owner
|
@ltwlf i use BindOnChange because it work for IL2CPP (and possibly for some AOT things in future) inside Unity. https://docs.unity3d.com/6000.0/Documentation/Manual/scripting-backends-il2cpp.html |
- Removed event handling for value changes in SyncableField. - Cleaned up unused using directives across several files. - Simplified the SyncVar struct by removing unnecessary event logic. - Enhanced method to find methods in class hierarchy for better flexibility. - Streamlined equality operator implementations for clarity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables on-change callbacks for value-type SyncVar<> fields by allowing users to specify a callback method name via [SyncVarFlags("CallbackName")]. Whenever a SyncVar<> changes.
Additionally, custom sync fields (e.g., SyncString, SyncNetSerializable) now support a ValueChanged event, letting developers subscribe to any changes.
Unfortunately, SyncVar Value Types and SyncFields must be handled differently.
Example: