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

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:
    106
    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:
    111
  3. Tigrian

    Tigrian

    Joined:
    Mar 21, 2021
    Posts:
    106
    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.