Search Unity

Passing data to shader in editor?

Discussion in 'Shaders' started by terids, Nov 6, 2017.

  1. terids

    terids

    Joined:
    Sep 23, 2017
    Posts:
    16
    Hello,

    I am trying to pass some variables from the editor to a shader. They pass fine during runtime, but not getting passed while running in the editor, ie. scene view.

    I am passing the variables inside OnInspectorGUI(), everything is populated before sending it to the shader, and I am passing them using Material.SetInt().

    Any ideas on why this wouldn't be working? I'm sure I've been able to get this working before. I have a feeling that something somewhere needs to be set to static.

    Thanks :)
     
  2. terids

    terids

    Joined:
    Sep 23, 2017
    Posts:
    16
    Solved.

    I was changing the Material instead of the sharedMaterial, which obviously doesn't work in the editor! :)