C# 7 - Weird syntax cause error CS0118: "TypeName is a type but is used like a variable"

I’m checking this open-source project Animation-Texture-Baker. I can run it fine in Unity Editor, but when I build the project in Visual Studio 2015, it keep telling me the error: Error CS0118 ‘AnimatorSystem.TransitionData’ is a type but is used like a variable’ at this line.

if (transitions.TryGetFirstValue(state, out TransitionData item, out NativeMultiHashMapIterator<int> iter))

I think the project is using C#7 because the file: Assembly-CSharp.csproj written:


Also I see that the project is using C#7 because it uses ECS: New way of CODING in Unity! ECS Tutorial - YouTube

I’ve tried install the compiler for C#7 with Nuget package, but the error still persists.

How can I fix that error?
Thanks for your time.

That’s a C# 7 feature, does the newest Unity support C# 7?

In C# 7, you’re allowed to declare the variable in the same line you use it as an out argument (as you do above), but Unity is complaining about that in your case as your version likely doesn’t support the syntax. Change that line to:

TransitionData item;
NativeMultiHashMapIterator<int> iter;

if (transitions.TryGetFirstValue(state, out item, out  iter))

My guess is to try:

TransitionData item;
 if (transitions.TryGetFirstValue(state, out item, out NativeMultiHashMapIterator *int*  iter))

but I am not familiar with the ins and outs of the Anumation-Texture-Baker project you are using. The int thing at the end seem off as well.