how to fix error CS8400

kemuel santiago 21 Reputation points
2021-10-01T04:07:40.957+00:00

Good Evening everyone,

My issue is that I purchased an assets on unity called Game Creator 2. When I imported it I started getting error codes:

Assets\Plugins\GameCreator\Packages\Core\Runtime\Common\Save\Memories\Types\GameObject\MemoryComponent.cs(32,45): error CS1026: ) expected

Assets\Plugins\GameCreator\Packages\Core\Runtime\Common\Save\Memories\Types\GameObject\MemoryComponent.cs(32,57): error CS1002: ; expected

Assets\Plugins\GameCreator\Packages\Core\Runtime\Common\Save\Memories\Types\GameObject\MemoryComponent.cs(32,57): error CS1513: } expected

When I selected the error it opened the script (using Visual Studio 2019) and the error that it gave me in the console in VS was:

Error CS8400 Feature 'not pattern' is not available in C# 8.0. Please use language version 9.0 or greater.

So i decided to fix the issue in Visual studio. What i did was download and install the latest .NET 5.0 they had to offer. I also downloaded all the workloads required like: "ASP.NET, and .NET crossplatform development". I also went to tools > Options > Preview Features > and checked the Box to "Use previews of the .NET SDK".

When none of that worked i continued to follow the steps here i found here

I wanted to use the "Configure Multiple Projects" and just add the "Directory.Build.props" file in the root. so i created the file in the top most file in my solution explorer which is the "Assembly-CSharp" file

What im not sure is if i created the right file in the right location. I Opened up my solution explorer by going to View > solution explorer in VS, and created a new item and made it a XML file. I don't know if that is the correct file format i just assumed because in the instructions XML was in the example given. I then added this line of code inside that file:

<Project>
<PropertyGroup>
<LangVersion>preview</LangVersion>
</PropertyGroup>
</Project>

it accepted the changes but still I continue to get all the same errors. I apologize i am very new at this and I am just trying to Figure out how to fix this issue. Thank you in advance for all your help!

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,274 questions
0 comments No comments
{count} votes

Accepted answer
  1. P a u l 10,406 Reputation points
    2021-10-01T15:15:55.093+00:00

    Do you know which version of Unity you're running? It looks like each version has a supported C# language version and the assets define scripts with unsupported C# syntax.

    If you toggle the version number in the top left you can see what C# language version is supported for each:
    https://docs.unity3d.com/2021.1/Documentation/Manual/CSharpCompiler.html

    Under "Supported Unity versions" on here you can see the version of Unity that's required to be compatible with the pack:
    https://assetstore.unity.com/packages/tools/game-toolkits/game-creator-2-203069

    It looks like this pack only supports 2021.2.0 which is the edge version (w/ C# 9)

    I'm not too familiar with Unity but it might be possible to download an older version of the pack that's compatible with your Unity version, or failing that you may need to upgrade Unity.


0 additional answers

Sort by: Most helpful