Search Unity

Can You Override Built-in Global Shader Parameters with Shader.SetGlobalFloat?

Discussion in 'Shaders' started by sgoodrow, May 20, 2015.

  1. sgoodrow

    sgoodrow

    Joined:
    Sep 28, 2012
    Posts:
    150
    Specifically I want to override the _Time shader parameter (to allow for pausing). I have many shaders which reference this parameter, and would like to override it rather than change them all.

    When does Unity update the _Time shader parameter? Is there an opportunity to set it after, every frame, before the frame renders?
     
  2. geroppo

    geroppo

    Joined:
    Dec 24, 2012
    Posts:
    140
    I don't think that's possible, but you could add ( on all the shaders...) a new variable like _CustomTime and mupltiply your _Time with it, and with that you could use SetGlobalFloat on the CustomTime.