Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved Setting material at runtime?

Discussion in 'Graphics for ECS' started by l33t_P4j33t, Dec 7, 2021.

  1. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    232
    doing
    EntityManager.SetSharedComponentData(entity, rendermesh);
    removes lightmaps when applied on a lightmapped object

    during conversion, the material gets copied and renamed when the object is lightmapped.

    if anyone managed to get this to work it would be extremely helpful
     
    Last edited: Dec 7, 2021
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Yes, lightmapping in Hybrid Renderer currently works by cloning the material and setting the static lightmap properties (including the lightmap texture) on the copy. If you want to manually set the material afterwards, you need to make sure the new material has the same properties.
     
    l33t_P4j33t likes this.