Page 1 of 1

Upgraded Mono .NET 4.6 in Unity 5.5

Posted: 29 Sep 2016, 22:38
by movra
There is now an experimental build of Unity 5.5.0b4 with .NET 4.6!

https://forum.unity3d.com/threads/upgra ... b4.433541/

So we can now use new C# 6 language features.

It simplifies PropertyChanged with the Safe Navigation Operator (?.), CallerMemberName and nameof(): https://jeremybytes.blogspot.nl/2016/02 ... of-in.html

CallerMemberName

Visual Studio will offer to convert your old school PropertyChanged implementation using null checks with a single line thread-safe delegate invocation using the ?. operator.

Image

With .NET 4.5's CallerMemberName not only you don't have to use magic strings, moreoever you don't even have to type the property name at all.

Image

nameof()

Image

Image

A bit more verbose than CallerMemberName, but the article linked above favors it for human readability. You're still avoiding magic strings with the literal property name, so refactoring won't break your code anymore.

MVVM classes

The MVVM classes are now built-in. System.Collection.ObjectModel.ObservableCollection, System.Windows.Input.ICommand, System.ComponentModel.INotifyPropertyChanged, etc.

Re: Upgraded Mono .NET 4.6 in Unity 5.5

Posted: 30 Sep 2016, 00:47
by jsantos
These are really good news! We will try it as soon as possible.

Unfortunately, it seems they are going to support the two paths (API 2.0 and API 4.6) so we won't be able to completely get rid of it .

Thanks movra for all this information! Very kind. : D

Re: Upgraded Mono .NET 4.6 in Unity 5.5

Posted: 30 Sep 2016, 09:08
by nokola
We've been using Noesis with C# 6 and async/await in Unity for 7 months now using https://bitbucket.org/alexzzzz/unity-c- ... n/overview

It's working great and our app is async/await heavy, with lots of code ported from C# 6 project.

Re: Upgraded Mono .NET 4.6 in Unity 5.5

Posted: 01 Oct 2016, 05:01
by nokola
And yes, the Unity Beta with C# 6 is awesome news - thanks for sharing!