Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. 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 Find the baked renderer entity of a skinnedMeshRenderer

Discussion in 'Graphics for ECS' started by Tigrian, Oct 10, 2022.

  1. Tigrian

    Tigrian

    Joined:
    Mar 21, 2021
    Posts:
    125
    Hello,

    When baking an authoring component on a skinnedMeshRenderer gameObject, GetEntity returns the entity holding the SkinMatrix component, not the one with the renderer which is a different one (skinnedMeshRenderer get baked into at least two entities).

    In 0.51, there was a thread to answer my question : ECS and skinned mesh rendering - Unity Forum. It was done using this :
    Code (CSharp):
    1. public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) {
    2. Unity.Entities.Conversion.MultiListEnumerator<Entity> ent = conversionSystem.GetEntities(this.gameObject);
    My question is, what is the new way of accessing this entity, with baking instead of conversion?
    In my case, I would like to add some material property overrides to a skinnedMeshRenderer.
    I could do a baking system iterating over all the entities with a skinMatrixBufferIndex, but this would not work, as I may have multiple skinnedMeshRenderer, and there would be no way to separate the good ones (which shall receive the overrides) from the bad.
     
  2. Jebtor

    Jebtor

    Unity Technologies

    Joined:
    Apr 18, 2018
    Posts:
    117
  3. Tigrian

    Tigrian

    Joined:
    Mar 21, 2021
    Posts:
    125
    Hello, I'm on my phone right now, but from what I can see, I've gone over the samples a bit quickly :)! This looks like exactly what I need. Thank you so much!
     
    Jebtor likes this.