Search Unity

Burst error adding component FrozenRenderSceneTag

Discussion in 'Burst' started by mentics, Jan 16, 2020.

  1. mentics

    mentics

    Joined:
    Aug 18, 2015
    Posts:
    10
    I'm seeing the burst error:
    Unable to access the managed method `object.Equals(object)` from type `Unity.Rendering.FrozenRenderSceneTag`


    In a job, I'm running:
    commandBuffer.AddSharedComponent<FrozenRenderSceneTag>(entityInQueryIndex, entity, frozenTag);


    frozenTag is a local variable. If I add
    .WithoutBurst()
    to the Entities.ForEach, then it doesn't give an error.

    Is this a known issue or something I'm not doing correctly?

    Complete error message:
    E:\data\UnityProjects\TestECS\Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Entities\Types\TypeManager.cs(1000,17): Burst error BC1001: Unable to access the managed method `object.Equals(object)` from type `Unity.Rendering.FrozenRenderSceneTag`

    at Unity.Entities.TypeManager.Equals(ref Unity.Rendering.FrozenRenderSceneTag left, ref Unity.Rendering.FrozenRenderSceneTag right) (at E:\data\UnityProjects\TestECS\Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Entities\Types\TypeManager.cs:996)
    at Unity.Entities.EntityCommandBuffer.IsDefaultObject(ref Unity.Rendering.FrozenRenderSceneTag component, ref int hashCode) (at E:\data\UnityProjects\TestECS\Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Entities\EntityCommandBuffer.cs:1055)
    at Unity.Entities.EntityCommandBuffer.Concurrent.AddSharedComponent(Unity.Entities.EntityCommandBuffer.Concurrent* this, int jobIndex, Unity.Entities.Entity e, Unity.Rendering.FrozenRenderSceneTag component) (at E:\data\UnityProjects\TestECS\Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Entities\EntityCommandBuffer.cs:1813)
    at AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0.OriginalLambdaBody(AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0* this, Unity.Entities.Entity entity, int entityInQueryIndex, ref Unity.Transforms.Translation pos) (at E:\data\UnityProjects\TestECS\Assets\TestReZeroing\Scripts\AvoiderSystem.cs:44)
    at AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0.IterateEntities(AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0* this, ref Unity.Entities.ArchetypeChunk chunk, ref AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0.LambdaParameterValueProviders.Runtimes runtimes)
    at AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0.Execute(AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0* this, Unity.Entities.ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
    at Unity.Entities.JobChunkExtensions.JobChunk_Process`1<AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0>.ExecuteInternal(ref Unity.Entities.JobChunkExtensions.JobChunkData`1<AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0> jobData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) (at E:\data\UnityProjects\TestECS\Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Entities\IJobChunk.cs:203)
    at Unity.Entities.JobChunkExtensions.JobChunk_Process`1<AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0>.Execute(ref Unity.Entities.JobChunkExtensions.JobChunkData`1<AvoiderSystem.<>c__DisplayClass_OnUpdate_LambdaJob0> jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) (at E:\data\UnityProjects\TestECS\Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Entities\IJobChunk.cs:193)


    While compiling job: System.Void Unity.Entities.JobChunkExtensions/JobChunk_Process`1<AvoiderSystem/<>c__DisplayClass_OnUpdate_LambdaJob0>::Execute(Unity.Entities.JobChunkExtensions/JobChunkData`1<T>&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)
     
    andywatts likes this.
  2. Curlyone

    Curlyone

    Joined:
    Mar 15, 2018
    Posts:
    41
    Getting the same :( I was trying to use it to make a primitive render culling system but since it cant be burstable its basically useless as it takes too much time, i wonder if anyone was able to make a render culling system
     
  3. andywatts

    andywatts

    Joined:
    Sep 19, 2015
    Posts:
    112
    Same here. I've been using FrozenSceneRenderTag to tag procgen RenderMesh entities as "static".

    Code (CSharp):
    1. var id = new uint4(1, 0, 0, 0);
    2. ecb.AddSharedComponent<FrozenRenderSceneTag>(entityInQueryIndex, meshEntity, new FrozenRenderSceneTag() { SceneGUID = new Hash128 { Value = id } });
    3. ecb.AddComponent<PerInstanceCullingTag>(entityInQueryIndex, meshEntity);
    Code (CSharp):
    1. client/Library/PackageCache/com.unity.entities@0.10.0-preview.6/Unity.Entities/Types/TypeManager.cs(627,17): Burst error BC1001: Unable to access the managed method `object.Equals(object)` from type `Unity.Rendering.FrozenRenderSceneTag`
    Hybrid Renderer 0.5.0-preview6 and entities 0.10.0-preview.6.
     
    Last edited: May 14, 2020
  4. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    417
    This is a problem in entities/AddSharedCompponent that does not support Burst currently. The underlying code is relying on `Equals(object)` while it should rely on `IEquatable<T>.Equals(T)` in order to be compatible with Burst.
     
  5. vildauget

    vildauget

    Joined:
    Mar 10, 2014
    Posts:
    121
    Does that mean we can expect a future Entities package update will change this as you suggest, and in the meantime, we should use .WithoutBurst() for the jobs using AddSharedComponent? Thank you.
     
  6. SisyphusStudio

    SisyphusStudio

    Joined:
    Nov 24, 2018
    Posts:
    9
    Running in this issue as well. A fix would be nice.
     
  7. cort_of_unity

    cort_of_unity

    Unity Technologies

    Joined:
    Aug 15, 2018
    Posts:
    98
    Yes. We'll ping this thread again when the fix has been merged.
     
  8. Innom

    Innom

    Joined:
    Dec 6, 2014
    Posts:
    6
    Given I just ran into this same bug month later, I'm guessing it's still not fixed?
     
  9. sietse85

    sietse85

    Joined:
    Feb 22, 2019
    Posts:
    99
    i'm also encountering this issue
     
  10. Lecks

    Lecks

    Joined:
    May 13, 2013
    Posts:
    18
    Same issue here in 0.16
     
  11. DreamersINC

    DreamersINC

    Joined:
    Mar 4, 2015
    Posts:
    131
    Has a fix been merged?