Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback Create entity API

Discussion in 'Entity Component System' started by illinar, Dec 6, 2020.

  1. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    863
    I'm a little confused why this is not supported?
    EntityManager.CreateEntity<ServerInitialized>();


    While this is:
    EntityManager.CreateEntity(typeof(ServerInitialized));


    And why ECB doesn't match the EM API and doesn't support this?
    ecb.CreateEntity(typeof(ServerInitialized));


    I will write extensions of course, but it seems like a logical API that would be supported.
     
    Baggers_ likes this.
  2. Singtaa

    Singtaa

    Joined:
    Dec 14, 2010
    Posts:
    492
    typeof
    doesn't go well with Burst. And ECB usually will be used along with Burst.
     
  3. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    863
    That makes sense, thank you.

    But wouldn't this go fine:
    commandBuffer.AddEntity<Comp>();


    If it already uses
    commandBuffer.AddComponent<Comp>(ent);


    If not, I'd think Burst could convert it to some form that is.
     
  4. Singtaa

    Singtaa

    Joined:
    Dec 14, 2010
    Posts:
    492
    So, CreateEntity<T, T, T, ...>() for both EntityManager and ECB? It's up to the Unity folks. :)