movra
Topic Author
Posts: 70
Joined: 02 Apr 2014, 20:35

Upgraded Mono .NET 4.6 in Unity 5.5

29 Sep 2016, 22:38

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.
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Upgraded Mono .NET 4.6 in Unity 5.5

30 Sep 2016, 00:47

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
 
nokola
Posts: 188
Joined: 10 Mar 2015, 05:29

Re: Upgraded Mono .NET 4.6 in Unity 5.5

30 Sep 2016, 09:08

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.
 
nokola
Posts: 188
Joined: 10 Mar 2015, 05:29

Re: Upgraded Mono .NET 4.6 in Unity 5.5

01 Oct 2016, 05:01

And yes, the Unity Beta with C# 6 is awesome news - thanks for sharing!

Who is online

Users browsing this forum: No registered users and 1 guest