vrchat-community / UdonSharp

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

Multiple instances of the same script share VRCUrl parameter value #32

Closed jacklul closed 2 years ago

jacklul commented 2 years ago

This issue happens after migrating project through Creator Companion.

Describe the bug in detail: If you add multiple instances of the same script anywhere in the scene they seem to share the VRCUrl type parameters and it's impossible to set them to different sets of these parameters. This bug happens only if the field is declared with default value of VRCUrl.Empty.

Provide steps/code to reproduce the bug: Tested with USharpVideo's PlayURLButton script, after setting up first button with URL1 adding second button with URL2 overwrites Url parameter in the first one with URL2.

Alternatively I'm providing sample scene and script to test this: USharpSharedParametersIssue.unitypackage.zip (try changing Url Bugged field and notice how it also changes on the other GameObject)

MerlinVR commented 2 years ago

This is a bug with the VRCUrl.Empty handling incorrectly assuming that it's immutable when it is not. I'll update USharpVideo to not use VRCUrl.Empty thanks!