vrchat-community / UdonSharp

A compiler for compiling C# to Udon assembly
https://udonsharp.docs.vrchat.com
MIT License
461 stars 50 forks source link

[1.1.8] Udon sync mode getting set to Continuous when a NoVariableSync is on the same GameObject as a Manual sync #134

Open techanon opened 1 year ago

techanon commented 1 year ago

Describe the bug in detail: Under the condition of having two udon behaviours on a single gameObject, when the first one is set to NoVariableSync, and the second is set to ManualSync, the gameObject will implicitly default to Continuous regardless of the second script.

Provide steps/code to reproduce the bug: Create two scripts, one with NoVariableSync mode and the other with Manual. Add a synced variable, like a string for example, to the Manual synced script. On the manual sync script, add the OnPreserialization and OnDeserialization events with a log statement in each. Add both scripts to the same game object. The order of the scripts don't matter. Build and test and watch the logs get spammed with the serialization logs.

Expected behavior: The GameObject should have sync mode of the first script in the order on the game object that is not of NoVariableSync. NoVariableSync should not be taken into consideration when choosing sync mode.

Additional Information: Here's a sample video of the issue occurring:

https://github.com/vrchat-community/UdonSharp/assets/1837484/0d1b627d-dafc-4da0-94cc-6f8448a57c5d