Search Unity

MaterialPropertyBlock.SetColorArray not available?

Discussion in 'Shaders' started by scwe_, Sep 26, 2016.

  1. scwe_

    scwe_

    Joined:
    Dec 12, 2013
    Posts:
    2
    So I was looking through the documentation and the release notes for Unity 5.4 and it says

    Shaders: Uniform array support
    • Uniform arrays can be set by new array APIs on MaterialPropertyBlock, Shader and Material.
    But it seems that MaterialPropertyBlock does not have support for SetColorArray in either Unity 5.4, 5.4.1 or 5.5b4. SetColorArray is however available on Material. Is this planned at anytime? Or is there some technical reason why this isn't being supported?
     
  2. scwe_

    scwe_

    Joined:
    Dec 12, 2013
    Posts:
    2
    On second thought, it should be reasonable to just use the SetVectorArray functions on MaterialPropertyBlock and then treat the Vector4's as Colors right?
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,343
    I don't have an answer for why it's not supported, but using SetVector on a color value automatically treats the values as if they're colors (ie: no gamma conversion needs to be done when setting the vector). SetVectorArray may be the same.