Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Compile failure

Discussion in 'Entity Component System' started by SahilMishra, Jul 9, 2023.

  1. SahilMishra

    SahilMishra

    Joined:
    Jul 31, 2021
    Posts:
    1
    Hi,
    getting these two errors running unity 2022.3.4f1

    Library\PackageCache\com.unity.entities@1.0.11\Unity.Entities.Hybrid.HybridComponents\CompanionComponentSupportedTypes.cs(41,20): error CS0104: 'DecalProjector' is an ambiguous reference between 'UnityEngine.Rendering.HighDefinition.DecalProjector' and 'UnityEngine.Rendering.Universal.DecalProjector'

    Failed to find entry-points:
    Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Unity.Transforms.Hybrid, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.Exception: Failed to resolve assembly 'Unity.Transforms.Hybrid, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' in directories: C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\MonoBleedingEdge\lib\mono\unityjit-win32
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.burst@1.8.7
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.burst@1.8.7\Unity.Burst.CodeGen
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.visualscripting@1.8.0\Editor\VisualScripting.Core\Dependencies\DotNetZip
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.nuget.mono-cecil@1.11.4
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.visualscripting@1.8.0\Editor\VisualScripting.Core\EditorAssetResources
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.collab-proxy@2.0.5\Lib\Editor\PlasticSCM
    C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\WebGLSupport
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.visualscripting@1.8.0\Editor\VisualScripting.Core\Dependencies\YamlDotNet
    C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.testtools.codecoverage@1.2.4\lib\ReportGenerator
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.ext.nunit@1.0.6\net35\unity-custom
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.collections@2.1.4\Unity.Collections.LowLevel.ILSupport
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.entities@1.0.11\Unity.Entities\SourceGenerators
    C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\Managed
    D:\Unity\DCC\Golf Game\Library\PackageCache\com.unity.visualscripting@1.8.0\Runtime\VisualScripting.Flow\Dependencies\NCalc
    C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Data\Managed\UnityEngine
    D:\Unity\DCC\Golf Game\Library\ScriptAssemblies ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Unity.Transforms.Hybrid, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <853812ae52c341daaef3c62ecdb86b32>:0
    at zzzUnity.Burst.CodeGen.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00013] in <532a8a169e6a4953b5d9a4c213b71772>:0
    --- End of inner exception stack trace ---
    at zzzUnity.Burst.CodeGen.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00060] in <532a8a169e6a4953b5d9a4c213b71772>:0
    at Burst.Compiler.IL.AssemblyLoader.Resolve (Mono.Cecil.AssemblyNameReference name) [0x0007e] in <532a8a169e6a4953b5d9a4c213b71772>:0
    at Burst.Compiler.IL.Server.EntryPointMethodFinder.FindEntryPoints (System.String[] rootAssemblyNames, Burst.Compiler.IL.Hashing.CacheRuntime.HashCacheAssemblyStore assemblyStore, Burst.Compiler.IL.AssemblyLoader assemblyLoader, Burst.Compiler.IL.NativeCompilerOptions options, Burst.Compiler.IL.Server.ProfileDelegate profileCallback, System.Boolean includeRootAssemblyReferences, System.Boolean splitTargets) [0x00055] in <532a8a169e6a4953b5d9a4c213b71772>:0
    at Burst.Compiler.IL.Server.CompilerServer.FindMethods (Burst.Compiler.IL.Server.CompilationRequest request, Burst.Compiler.IL.Server.Caching.CacheManager cacheManager, Burst.Compiler.IL.CompilerStatistics stats) [0x000f5] in <532a8a169e6a4953b5d9a4c213b71772>:0
    at Burst.Compiler.IL.Server.CompilerServer+<>c__DisplayClass17_0.<Compile>b__0 (Burst.Compiler.IL.Server.Caching.CacheManager cacheManager) [0x00000] in <532a8a169e6a4953b5d9a4c213b71772>:0
    at Burst.Compiler.IL.Server.CompilerServer+<>c__DisplayClass26_0`1[TResult].<RunTask>b__0 () [0x00145] in <532a8a169e6a4953b5d9a4c213b71772>:0
    at Burst.Compiler.IL.Server.CompilerServer.RunTask[TResult] (Burst.Compiler.IL.Server.TargetKey target, System.String taskName, System.String[] assemblyFolders, System.Threading.CancellationToken cancellationToken, System.Func`2[T,TResult] function) [0x00131] in <532a8a169e6a4953b5d9a4c213b71772>:0
    at Burst.Compiler.IL.Server.CompilerServer.Compile (Burst.Compiler.IL.Server.CompilationRequest request, Burst.Compiler.IL.Server.CompilationMessageStreamer streamer, System.Threading.CancellationToken cancellationToken) [0x0017f] in <532a8a169e6a4953b5d9a4c213b71772>:0

    While compiling job:


    upload_2023-7-9_0-45-26.png
     
  2. StickyKevin

    StickyKevin

    Joined:
    Jul 1, 2020
    Posts:
    22
    Your first issue can be resolved by specifying from which Assembly you want to use the DecalProjector from, since both UnityEngine.Rendering.HighDefinition and 'UnityEngine.Rendering.Universal have a definition.
    Hence the ambiguous reference.
    You can do this by adding either
    Code (CSharp):
    1. using DecalProjector = UnityEngine.Rendering.HighDefinition.DecalProjector;
    or
    Code (CSharp):
    1. using DecalProjector = UnityEngine.Rendering.Universal.DecalProjector;
    to the top of your class file next to the usings.

    I am not certain about the second one, but it could be that the first issue could cause it as well.
     
  3. VinyxAi

    VinyxAi

    Joined:
    Jul 15, 2018
    Posts:
    8
    The error is from the Unity Cache
    Library\PackageCache\com.unity.entities@1.0.11\Unity.Entities.Hybrid.HybridComponents\CompanionComponentSupportedTypes.cs(41,20)

    It is effectively read-only as the library is managed automatically and any changes will be overwritten automatically.

    The define should be handled by this section:

    #if HDRP_7_0_0_OR_NEWER
    using UnityEngine.Rendering.HighDefinition;
    #endif
    #if URP_7_0_0_OR_NEWER
    using UnityEngine.Rendering.Universal;
    #endif

    However URP_7_0_0_OR_NEWER is set to false, therefore it does not know which to use.
    I am using URP 14, and I don't know why Unity is overriding URP_7_0_0_OR_NEWER to false.
     
  4. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,626
    This issue happens if you have both HDRP and URP enabled in the project (i consider this a bug though)
     
    VinyxAi likes this.
  5. VinyxAi

    VinyxAi

    Joined:
    Jul 15, 2018
    Posts:
    8
    Welp, thanks. That's weird, the only packages I installed are ECS and Unity Terrain for URP, in a brand new URP project. I wonder why HDRP was added. I would have guessed automatically as a dep, but it was not marked as a dependency.

    I removed the package and things seem fine. Hopefully I did not break something for down the road.