0
\$\begingroup\$

SyncVar and RPC calls allow a UNET server to send messages to clients, but these messages are not triggered if the server-side change comes from the inspector or a custom editor (and presumably any non-MonoBehaviour).

EG I use the inspector to change a SyncVar - only the server is updated. Or press a CustomEditor button which calls a method marked with Target/ClientRpc - it will just execute that method on the server.

What is the best way to call UNET networking functions from Inspector GUIs and non-MonoBehaviour code?

\$\endgroup\$
0
\$\begingroup\$

When using a SyncVar, a network change can be triggered by adding a custom Editor with a field of the same type. This editor can then set the syncvar property to match the editor value when it change, which lets network updates trigger as normal.

\$\endgroup\$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.