Netcode Hooks

In UNet, it was possible to use hooks on client to signal when a SyncVar changes on server and thus changes client value: Unity - Scripting API: Networking.SyncVarAttribute.hook
This allowed a method to be called when a value on a client changes, very useful.

In Netcode, I’m not seeing an obvious/built-in way to signal on a client that a field value of a ghost on client has been changed due to being changed on server.

Am I missing something, or does this need to be built by us at this time?
If it needs to be built on our end, any suggestions on what the best path for this might be?

I use a cached copy of the component’s value and compare it to the synced component framely

1 Like

Thank you Kender. That is one method I considered, so it’s good to hear someone else is already using it.

That seems to be a candidate for reactive systems :

1 Like

Thanks so much for this. I had created something temporary, but your solution here seems more robust and well thought-out than what I’ve already implemented.

I will likely use this in the future as the project grows and more reactive systems are needed.

Happy to help, feel free to use it however you like. If you find any issue or if you have any suggestions please to contact me :wink: