Issues when building in Unity 2022

Hi there!
I was following the developer-setup guide and successfully created a tgz file. When I tried to import it using Unity Package Manager I get those errors:

Unity.SourceGenerators\Unity.MonoScriptGenerator.MonoScriptInfoGenerator\AssemblyMonoScriptTypes.gen.cs(5,20): error CS0101: The namespace ‘’ already contains a definition for ‘UnitySourceGeneratedAssemblyMonoScriptTypes_v1’

Unity.SourceGenerators\Unity.MonoScriptGenerator.MonoScriptInfoGenerator\AssemblyMonoScriptTypes.gen.cs(2,6): error CS0579: Duplicate ‘System.Runtime.CompilerServices.CompilerGenerated’ attribute

Unity.SourceGenerators\Unity.MonoScriptGenerator.MonoScriptInfoGenerator\AssemblyMonoScriptTypes.gen.cs(3,6): error CS0579: Duplicate ‘System.ComponentModel.EditorBrowsableAttribute’ attribute

Unity.SourceGenerators\Unity.MonoScriptGenerator.MonoScriptInfoGenerator\AssemblyMonoScriptTypes.gen.cs(4,6): error CS0579: Duplicate ‘System.CodeDom.Compiler.GeneratedCodeAttribute’ attribute

Unity.SourceGenerators\Unity.MonoScriptGenerator.MonoScriptInfoGenerator\AssemblyMonoScriptTypes.gen.cs(301,40): error CS0111: Type ‘UnitySourceGeneratedAssemblyMonoScriptTypes_v1’ already defines a member called ‘Get’ with the same parameter types

Unity.SourceGenerators\Unity.MonoScriptGenerator.MonoScriptInfoGenerator\AssemblyMonoScriptTypes.gen.cs(276,10): error CS0579: Duplicate ‘System.Runtime.InteropServices.StructLayout’ attribute

I was building the package using Unity 2022 as I want to try the new polygon clipping feature.
Any idea what can I do? Thanks a lot :slight_smile:

My setup:
Unity 2022.3.20f1
Visual Studio 2022
cmake 3.28.3
dotnet 8.0.201

Hi @Tomer_Ben-gigi,

Welcome to the community! We just released Cesium for Unity v1.8.0, which includes the polygon clipping feature you were trying to use. I suggest downloading it from the package registry, or from the Github release if the .tgz file is needed. Let us know how it goes!

Happen to me also.
Fixed it by opening the tar.gz and the tar inside it and doing the following modifications:

com.cesium.unity-1.8.0\package\Editor\generated\Unity.SourceGenerators\Unity.MonoScriptGenerator.MonoScriptInfoGenerator\AssemblyMonoScriptTypes.gen.cs:

  • class UnitySourceGeneratedAssemblyMonoScriptTypes_v1 → UnitySourceGeneratedAssemblyMonoScriptTypes_v2

com.cesium.unity-1.8.0\package\Runtime\generated\Unity.SourceGenerators\Unity.MonoScriptGenerator.MonoScriptInfoGenerator\AssemblyMonoScriptTypes.gen.cs (there are 2 classes named UnitySourceGeneratedAssemblyMonoScriptTypes_v1):

  • class UnitySourceGeneratedAssemblyMonoScriptTypes_v1 → UnitySourceGeneratedAssemblyMonoScriptTypes_v3
  • class UnitySourceGeneratedAssemblyMonoScriptTypes_v1 → UnitySourceGeneratedAssemblyMonoScriptTypes_v4

After that do “Add package from disk…” in the Package Manager

2 Likes

Welcome to the community @Tal_Che ! Thank you for sharing your solution with the rest of the community. :smile:

I’ve gone ahead and opened a Github issue with the details from this forum thread. Thank you @Tomer_Ben-gigi for the initial report!