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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Is Burst Not Support AddSharedComponent?

Discussion in 'Burst' started by ddoq2008, Sep 7, 2022.

  1. ddoq2008

    ddoq2008

    Joined:
    Sep 21, 2019
    Posts:
    2
    Hi all,
    in ecs 0.51.0-preview.32,when use EntityCommandBuffer.ParallelWriter call AddSharedComponent,

    in runtime console error:
    Burst error BC1051: Invalid managed type found for the field `EqualFn` of the struct `Unity.Entities.FastEquality.TypeInfo`.: the type `System.Delegate` is a managed type and is not supported

    Code (CSharp):
    1. public struct TestShared : ISharedComponentData
    2. {
    3.         public int Value;
    4. }
    Code (CSharp):
    1. private static void CreateIsoObject(EntityCommandBuffer.ParallelWriter ecb,
    2.             int entityInQueryIndex, EntityArchetype archetype,
    3.             int num, Entity prototype)
    4. {
    5.         var random = new Random(1);
    6.         for (var i = 0; i < num; i++)
    7.         {
    8.             var entity = ecb.Instantiate(entityInQueryIndex, prototype);
    9.  
    10.             var x = random.NextFloat(0, 10).Fixed(0);
    11.             var y = random.NextFloat(0, 10).Fixed(0);
    12.             var d = new IsoObject
    13.             {
    14.                 IsoPosition = new Vector3(x, y, 0),
    15.                 IsoSize = Vector3.one,
    16.             };
    17.  
    18.             //error line
    19.             ecb.AddSharedComponent(entityInQueryIndex, entity, new TestShared{Value = 1});
    20.  
    21.             ecb.AddComponent(entityInQueryIndex, entity, d);
    22.             ecb.AddComponent<PosChangedTag>(entityInQueryIndex, entity);
    23.             }
    24. }
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    3,993
    Not supported in Entities 0.51, and not the Burst Team's fault.
     
  3. ddoq2008

    ddoq2008

    Joined:
    Sep 21, 2019
    Posts:
    2
    Thanks