- Home /
Why cant I use [^index] to index from the end of an array, even though I'm in c# 8.0?
On the microsoft c# docs website, it says you can use [^index] to index from the end of an array in c# 8.0 and later, well, I'm in c# 8.0, but it doesn't work. I'm wondering if it's possible to make it work by updating Unity, or if there's some other solution. I'd also just like to know why this doesn't work, even if there's no solution.
Answer by Hellium · Oct 28, 2020 at 05:01 PM
C# 8.0 seems to be supported with Unity 2020.2 (currently in beta)
https://docs.unity3d.com/2020.2/Documentation/Manual/CSharpCompiler.html
Unity 2018.3 → 2020.1 support # 7.3
https://docs.unity3d.com/2018.3/Documentation/Manual/CSharpCompiler.html
https://docs.unity3d.com/2020.1/Documentation/Manual/CSharpCompiler.html
Yes, but nothing I can see there would indicate that I wouldn't be able to use the new indexes and ranges, yet, they do not work. Can you get them to work?
Are you actually using 2020.2 (beta)? Have you set the Scripting runtime version to .Net 4.X equivalent?
Did you take a look at https://forum.unity.com/threads/unity-c-8-support.663757/ ?