Skip to content

Releases: MerlinVR/UdonSharp

UdonSharp 1.2-beta1: Non-Behaviour scripts, Lists, Dictionaries, and more

23 Nov 03:44
2a722bf
Compare
Choose a tag to compare

UdonSharp 1.2 beta 1

Hey all, it's been a while! This release adds support for non-UdonSharpBehaviour scripts to U#. So now stuff like this is valid and supported:

public class MyCoolClass
{
    int a;
    string b;

    public MyCoolClass(int a, string b)
    {
        this.a = a;
        this.b = b;
    }
    
    public string GetStr() => $"a: {a}, b: {b}";
}

public MyBehaviour : UdonSharpBehaviour
{
    void Start()
    {
        MyCoolClass myObj = new MyCoolClass(42, "hi");
        Debug.Log($"a: {myObj.a}, b: {myObj.b}"); // "a: 42, b: hi"
        Debug.Log(myObj.GetStr()); // "a: 42, b: hi"
    }
}

This includes support for generic types, along with this support I've also implemented 'fake' versions of List<>, Dictionary<>, HashSet<>, Queue<>, and Stack<>. Dictionaries and HashSets handle types with custom .GetHashCode/.Equals as well so long as they are typed on the dictionary key type or hashset value type as the concrete type and not some generic type like object. You can do things like operator overloading as well. Serialization is handled on user types as well.

This release should be compatible with persistence as all that requires are some stub functions that I've added.

This has some caveats here; struct types are not handled because Udon doesn't provide a good way to handle them properly without a ton of overhead. Inheritance is not supported on non-behaviour types due to how easily it'd cause Udon programs to bloat in size and not having very nice tradeoffs to address this otherwise. Please report bugs on this github or my discord server and I'll try to address them when I can.

There are some bugs that I still want to address, and some smaller features I'd like to add so I'll probably be updating this a bit over time.

Installation is also super jank due to how VRC has a copy of U# directly in the SDK I want to make it better, but I advise against using this in prefabs you are looking to distribute.

Installation

Make a backup of your project first, if Unity screws up with importing stuff like this, it can screw up badly.

  1. Close your project
  2. Make sure your project is backed up
  3. Go to the Packages/com.vrchat.worlds/Integrations folder and delete the UdonSharp folder and its UdonSharp.meta file
  4. Grab the com.merlin.UdonSharp_1.2.0-b1.zip file from the files on this page. Do not use any of the other files that github puts there, they are very out of date since this github has not had the changes merged in.
  5. Extract the com.merlin.UdonSharp folder in the zip file into the Packages directory in your project.
  6. Open your project again, and if everything worked your project should work just as you left it and can now use the new features.

Thanks for your support everyone, sorry I couldn't make it work out better.

Sync mode None support

15 Sep 22:24
a074757
Compare
Choose a tag to compare

Make sure you are using the latest VRCSDK

If you are upgrading from Unity 2018, follow the upgrade instructions https://docs.vrchat.com/v2021.3.2/docs/migrating-from-2018-lts-to-2019-lts pay special attention to step 2.5 MAKE A BACKUP OF YOUR PROJECT BEFORE UPGRADING IT TO 2019.4

  • 0d6daed: Add support for sync mode none on UdonSharpBehaviours
  • #110: Improve default create script location, contributed by @FairlySadPanda

Bug fixes and 2019.4 support

04 Aug 22:50
Compare
Choose a tag to compare

If you are upgrading to Unity 2019.4, make sure you are using the latest VRCSDK and follow the upgrade instructions https://docs.vrchat.com/v2021.3.2/docs/migrating-from-2018-lts-to-2019-lts pay special attention to step 2.5

MAKE A BACKUP OF YOUR PROJECT BEFORE UPGRADING IT TO 2019.4

MAKE A BACKUP OF YOUR PROJECT BEFORE UPGRADING IT TO 2019.4

MAKE A BACKUP OF YOUR PROJECT BEFORE UPGRADING IT TO 2019.4

Unity 2019.4 Interface Fix

17 Jul 19:03
Compare
Choose a tag to compare
Pre-release

For use with the 2019.4 open beta. This is compatible with Unity 2018.4 and 2019.4

  • a1e1a49: Fix inspector handling that was using the fallback inspector due to Unity changing how custom editors are located in 2019.4
  • 308e752: Fix compile errors when using attributes on properties
  • #88: Fix usage of return in property setters not working, fixed by @ChanyaKushima

Property Support

09 Jul 00:29
9418913
Compare
Choose a tag to compare

This release requires the latest VRCSDK

Features

  • #85: Support for user defined C# properties on UdonSharpBehaviours implemented by @mika-f
    Property syntax with getters and setters is now valid, for example this works now:
float _myFloat = 5f;
public float MyFloatProperty
{
    get { return _myFloat; }
    set { _myFloat = value; }
}

private void Start()
{
    Debug.Log(MyFloatProperty);
}
  • #87: Support for Udon's new OnVariableChange events via FieldChangeCallback. This can be used to let properties automatically execute their setter when network sync updates the marked field.
  • 98f8c87: NoVariableSync mode will now attempt to match the common variable sync mode between UdonBehaviours on the same GameObject. This means you can now use your non-synced scripts on GameObjects with manually synced scripts.
  • d61ba6d: Support for PostLateUpdate event

Fixes

  • a9642c0: Fix scene getting dirtied redundantly when using NoVariableSync
  • fe79cc5: Fix handling for updating prefab properties in the scene
  • 61f725a: Remove collision transfer option from UdonBehaviour inspector and force to off since it is no longer respected by the client.
  • 603ae98: Fix foreach loops on iterators that are retrieved from expressions while inside recursive methods, reported by GlitchyDev

Add support for DisableInteractive

05 Jun 15:47
Compare
Choose a tag to compare

This version requires the latest VRCSDK

If you are updating from <v0.19.2, you need to delete the Assets/UdonSharp/Plugins folder before installing this

  • 44b47e8: Add support for new DisableInteractive property on UdonBehaviours

Udon Network Update Support

17 May 23:49
b952ca7
Compare
Choose a tag to compare

This version requires the latest VRCSDK

If you are updating from <v0.19.2, you need to delete the Assets/UdonSharp/Plugins folder before installing this

  • Add new supported sync types to allowed sync variable types
  • Add UI for manual sync vs continuous sync selection to UdonSharpBehaviour inspector
  • Add warning and conversion for objects using the now-deprecated position sync option, in favor of using the new VRC Object Sync component instead
  • Add UdonBehaviourSyncMode attribute to optionally enforce a chosen sync mode and preform additional validation on synced variables
  • Switch to use new Udon methods to check sync type compatibility (which allows use of the array sync)
  • Add handling for calling RequestSerialization() on UdonSharpBehaviours
  • Add handling for the OnOwnershipTransferRequest and OnPostSerialization events
  • Add handling for the previous owner being passed to OnOwnershipTransferred
  • Update sync utility scripts to use reliable sync
  • Add build validation for sync mode conflicts

Networking open beta update

15 May 00:53
Compare
Choose a tag to compare
Pre-release

This release is only for use with the open beta VRCSDK, if you are using live, use 0.19.8. If you are updating from UdonSharp <v0.19.2, you need to delete the Assets/UdonSharp/Plugins folder before installing this

  • 7507e92: Add support for SerializationResult on OnPostSerialization, note any scripts currently using OnPostSerialization will need to be updated to include the new argument.

Sync beta support

17 Apr 01:44
Compare
Choose a tag to compare
Sync beta support Pre-release
Pre-release

This release is only for use with the open beta VRCSDK, if you are using live, use 0.19.8. If you are updating from UdonSharp <v0.19.2, you need to delete the Assets/UdonSharp/Plugins folder before installing this

  • 6cca77f: Merge master into sync-beta for delayed event support and recent fixes

Work around mono bug on Japanese locale + other minor fixes

28 Mar 04:21
Compare
Choose a tag to compare
  • c8e87cf: Changes to U#, Harmony, Unity, and Odin to work around mono/mono#20968 where possible, and add an error to describe the fix for the inevitable time when other libraries I don't have the ability to patch have issues. Thanks for help with the repro @ikuko, @esnya, and Tony_Lewis
  • 4ae86a3: Fix implicit type conversion handling in array creation, reported by @ureishi
  • 205e3ad: Strip comments and whitespace on exported assembly assets
  • ab14976: Fix player name detection on log watcher, and update filter list for VRC logs
  • 4042459: Remove warning about debug info not existing since it isn't really an issue most of the time and can be confusing for people
  • f2de786: More explicit handling for if program assets don't match serialized program assets
  • 2cb4a66: Mark UdonSharpEditorCache as public so it can be queried for debug info, requested by @orels1