Search Unity

How to use IPropertyCollector to set preview for renderers?

Discussion in 'Timeline' started by SunnyChow, Feb 10, 2021.

  1. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    360
    i am making a custom timeline clip that switch materials (sharedMaterials). Unfortunately, i can't make
    GatherProperties() works with renderers. i can make IPropertyCollector works with transform position, but not materials. i have goolged it for quite a while but no useful feedback. Do anyone has any suggestion?

    i have tried ...

    Code (CSharp):
    1. driver.AddFromComponent(renderer.gameObject,renderer);
    2. driver.AddFromName(renderer,"m_Materials");
    3. driver.AddFromName(renderer,"m_SharedMaterials");
    4. driver.AddFromName(renderer,"m_materials");
    5. driver.AddFromName(renderer,"m_sharedMaterials");
     
  2. dimmduh1

    dimmduh1

    Joined:
    Feb 5, 2021
    Posts:
    24
    I guess you need to use ExposedReference
     
  3. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    AnimationClips bind to
    m_Materials.Array.data[0]
    (change the index based on which material you want to change).

    Please tell me if this works for you
     
    mandisaw and SunnyChow like this.