MerlinVR / UdonSharp

An experimental compiler for compiling C# to Udon assembly
MIT License
678 stars 89 forks source link

Add field initializers #1

Closed Toocanzs closed 4 years ago

Toocanzs commented 4 years ago

Field initializers are now run at compile time from within C#. This also means you can do things that aren't possible in Udon in field initializers, assuming you don't have to import anything that doesn't exist in Udon.

For example this isn't possible in Udon, but works fine as a field in U# int foundIndex = (new System.Collections.Generic.List<int> { 3, 4 }).BinarySearch(4);