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

Resolved Is this an issue? "EntityManager.SetComponentData<T>()" doesn't accept my T

Discussion in 'Entity Component System' started by F, May 11, 2023.

  1. F

    F

    Joined:
    Sep 28, 2012
    Posts:
    13

    Attached Files:

  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,623
    Documentation appears to be wrong. If you look at actual source you'll see the api is actually unmanaged not struct

    Code (CSharp):
    1.         /// <summary>
    2.         /// Sets the value of a component of an entity.
    3.         /// </summary>
    4.         /// <param name="entity">The entity.</param>
    5.         /// <param name="componentData">The data to set.</param>
    6.         /// <typeparam name="T">The component type.</typeparam>
    7.         /// <exception cref="ArgumentException">Thrown if the component type has no fields.</exception>
    8.         [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(BurstCompatibleComponentData) })]
    9.         public void SetComponentData<T>(Entity entity, T componentData) where T : unmanaged, IComponentData
     
    F, elliotc-unity and Anthiese like this.
  3. F

    F

    Joined:
    Sep 28, 2012
    Posts:
    13
    Oh, I should've noticed that! thank you.
     
  4. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,292
    It was changed in 1.0, previously it was constrained to struct.
     
  5. elliotc-unity

    elliotc-unity

    Unity Technologies

    Joined:
    Nov 5, 2015
    Posts:
    228
    Anthiese and xVergilx like this.