Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Get control back from MaterialPropertyBlock

Discussion in 'Shaders' started by AcidArrow, May 19, 2019.

  1. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    This is a workflow question:

    Is there an easy way at runtime (in editor) to edit the color of a material/renderer after it has been set by a MaterialPropertyBlock?

    We're setting the colors of a bunch of meshes with material property block at runtime. The final color is lerped from an array of colors which are chosen based on where they are and a bunch of other parameters.

    All this works fine, but I've lost the ability to quickly try colors at runtime since "MaterialPropertyBlock is used to modify these values".

    I mean, I used to Play and at various points, press pause and then go to the inspector and change the color so I can find the color I want, then put that in the array.

    I know I can script it, I'm just wondering if there is an easy-ier way.
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    You’d have to solve this yourself with some kind of component or custom inspector that modifies the material property block values.
     
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    Yeah, that's what I was afraid of. Thanks.