Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question Adding Graphics with a Baker?

Discussion in 'Graphics for ECS' started by thelebaron, Nov 12, 2022.

  1. thelebaron


    Jun 2, 2013
    Theres an api for runtime, and I found a messy workaround to copy a prefab entity's components inside of a baking system but if I want to do some stuff inside of a baker I cant appear to find anything currently that isn't internal to support this. Is this planned in any way?
  2. mcfadyeni


    Sep 1, 2022
    Not sure about adding the components itself. The way I've done this so far is to do `GetEntity(gameObject)` on the GameObject that the graphics (Mesh Filter etc) is on, and then spawning that (both inside the baker).

    As far as I can tell, the `GetEntity` does the conversion of the graphics stuff automatically (it converts the components to their Entities Graphics counterparts for you).
  3. StefanWo


    May 24, 2015
    You can just replace the RenderMesh in a BakingSystem, seems working fine for me. To be sure, maybe its good to do it in the
    Code (CSharp):
    2. [UpdateInGroup(typeof(TransformBakingSystemGroup))]
    3. ...
    4.             var renderMesh = EntityManager.GetSharedComponentManaged<RenderMesh>(entity);
    5.             renderMesh.mesh = newMesh;
    6.             EntityManager.SetSharedComponentManaged(entity, renderMesh);