BetterSharpForUnity provides a foundation for developing with C#10 or C#11 in Unity.
This library is currently under development and subject to destructive changes.
Unity 2022.3 or newer
Add the following line to manifest.json
"com.github-troubear.bettersharpforunity": "https://github.com/troubear/BetterSharpForUnity.git?path=Packages/BetterSharpForUnity",Or, install from Package Manager -> Add package from git URL...
ProjectSettings -> Player -> Additional Compiler Arguments -> Add -langVersion:10
- Create
csc.rspin the same folder as*.asmdef - Add
-langVersion:10tocsc.rsp
Just change -langVersion:10 to -langVersion:preview.
Provides a compatible subset API of UnityEngine.Assertions.Assert that leverages C#10 functionality.
Assert.IsTrueAssert.IsFalse
- String interpolation of message is performed only if the assertion fails. You don't have to be afraid of GC anymore.
- Assertion expressions are output to the log as strings. Good news for all you lazy people.
- These methods can benefit from static code analysis as well as System.Diagnostics.Debug.Assert