Search Unity

Material Property Blocks with Mesh Renderers that have multiple materials

Discussion in 'General Graphics' started by AlexTemina, Jan 16, 2017.

  1. AlexTemina

    AlexTemina

    Joined:
    Feb 19, 2014
    Posts:
    44
    I am trying to set different MaterialPropertyBlocks for a MeshRenderer that has 2 material. But as far as I know, this is not possible, since you get the MaterialPropertyBlock from the renderer, and you cannot choose which material to apply the property block to.
    Is there a way to solve or work-around this? thanks!
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Use two renderers. Either split the mesh or leave one material in the renderer's materials array null.
     
  3. AlexTemina

    AlexTemina

    Joined:
    Feb 19, 2014
    Posts:
    44
    problem is this is Ferr2D, I cannot set 2 renderers... I asked in their thread also.
     
  4. halzate93

    halzate93

    Joined:
    Apr 24, 2013
    Posts:
    6
  5. chriscode

    chriscode

    Joined:
    Mar 2, 2015
    Posts:
    49
    How do you know which material is which index?
     
  6. qvesk1997

    qvesk1997

    Joined:
    Nov 17, 2018
    Posts:
    6
    Check it in editor
    upload_2023-11-6_21-32-49.png