Unity C# 8 support

Simple question is: Do Unity have plans to support C# 8. If they Do - When? :slight_smile:

1 Like

Yes, we do plan to support C# 8. We don’t have a release date yet, although I expect our support for it will lag a bit behind Microsoft’s.

4 Likes

I doubt C# 8 itself has a release date yet.

Ok it is good thanks :slight_smile:

Really I have just looking for undated roslyn compiler with support of C#8 so we can enable C#8 through csc.rsp and have benefits of NullableReference warnings in our project :slight_smile:

You can play with the project I uploaded a while ago: Would the Roslyn Compiler compile C# 8.0 preview?

It has Roslyn C# 8.0 Preview compiler integrated. If there is a version of Roslyn newer than 2.11.0.63519, I believe, you can just replace the whole Roslyn folder there with the new version.

2 Likes

Thanks @alexzzzz I will try it :slight_smile:

Any update on the release date for C# 8 support?

1 Like

Likely sometime in the 2020 release cycle.

8 Likes

Update: C# 8 is released now, i personally need native json support
https://github.com/dotnet/corefx/issues/33115

1 Like

Cool.
Waiting for Nullables support :slight_smile:
I have event prepare command to make nullables warnings to be errors :slight_smile:

How’s it looking with C# 8 in Unity, any chance it will come with 2019.3?

No, as mentioned above, it will be in the 2020 release cycle at the earliest. We don’t currently have an ETA, so it might be later.

3 Likes

May be you have plans to update C# compiler to latest released so we can adlast turn on some syntactic sugar without true support of new features?

5 Likes

+1 on this, since after c#8, default interface methods are supported.

2 Likes

+1, static extensions and default interface implementations are sweet :slight_smile:

1 Like

+1
I don’t think static extensions are part of C# 8.
But I’m waiting for default interface implementation and some minor things like readonly members and unmanaged constructed types might fit very well into DOTS.

+5 million
simple ‘using’ statements :smile:
switch expressions :sunglasses:

And a personal favorite;
this:

int[] array = { 1, 3, 5, 7, 9 };
int i = array[^1]; // returns 9
int[] subArray = array[1..3]; // returns { 3, 5 }
int[] subArray2 = array[^2..]; // returns { 7, 9 }
3 Likes

array[1…3] should return 2 elements.

More than c# 8 I need .net standard 2.1 support (fast span). is there a plan for that or will they potentially come together?

2 Likes

Fast span is pretty important for working with memory in cache friendly ways.

1 Like