Skip to main content
Tweeted twitter.com/StackGameDev/status/1184982567109517314
added 7 characters in body
Source Link
Andrey
  • 230
  • 2
  • 12

I recently rewrote a shared I was using into Shader Graph. As an example I carried out the color as an external parameter.

In my traditional shader to set the color I would call something like

MyMaterial.SetColor("_NewColor", color)

In the new code, I could not figure out the name of the parameter until I looked at the generated code. Turns out my Color parameter was actually named "Color_D027E98" So now my code is

MyMaterial.SetColor("Color_D027E98", color);

Not very pretty and I don't know how constant D027E98 is. Is this the correct way of changing a shader's parameter? Should I be doing something different using Shader Graph - Is this number going to change on me as if I update my shader?

I recently rewrote a shared I was using into Shader Graph. As an example I carried out the color as an external parameter.

In my traditional shader to set the color I would call something like

MyMaterial.SetColor("_NewColor")

In the new code, I could not figure out the name of the parameter until I looked at the generated code. Turns out my Color parameter was actually named "Color_D027E98" So now my code is

MyMaterial.SetColor("Color_D027E98", color);

Not very pretty and I don't know how constant D027E98 is. Is this the correct way of changing a shader's parameter? Should I be doing something different using Shader Graph - Is this number going to change on me as if I update my shader?

I recently rewrote a shared I was using into Shader Graph. As an example I carried out the color as an external parameter.

In my traditional shader to set the color I would call something like

MyMaterial.SetColor("_NewColor", color)

In the new code, I could not figure out the name of the parameter until I looked at the generated code. Turns out my Color parameter was actually named "Color_D027E98" So now my code is

MyMaterial.SetColor("Color_D027E98", color);

Not very pretty and I don't know how constant D027E98 is. Is this the correct way of changing a shader's parameter? Should I be doing something different using Shader Graph - Is this number going to change on me as if I update my shader?

Fix typo in title + add code formatting + typo fixes
Source Link

In unity'sUnity's Shader Graph how do you access paramitersparameters from code?

I recently rewrote a shared I was using into Shader Graph. As an example I carried out the color as an external parameter.

In my traditional shader to set the color I would call something like MyMaterial.SetColor("_NewColor")

MyMaterial.SetColor("_NewColor")

In the new code i, I could not figure out the name of the paramiterparameter until I looked at the generated code. Turns out my Color parameter was actually named "Color_D027E98" So now my code is
MyMaterial.SetColor("Color_D027E98", color);

MyMaterial.SetColor("Color_D027E98", color);

Not very pretty and I don't know how constant D027E98 is. Is this the correct way of changing a shader's parameter? Should I be doing something different using Shader Graph. - Is this number going to change on me as if I update my shader?

In unity's Shader Graph how do you access paramiters from code?

I recently rewrote a shared I was using into Shader Graph. As an example I carried out the color as an external parameter.

In my traditional shader to set the color I would call something like MyMaterial.SetColor("_NewColor")

In the new code i could not figure out the name of the paramiter until I looked at the generated code. Turns out my Color parameter was actually named "Color_D027E98" So now my code is
MyMaterial.SetColor("Color_D027E98", color);

Not very pretty and I don't know how constant D027E98 is. Is this the correct way of changing a shader's parameter? Should I be doing something different using Shader Graph. Is this number going to change on me as if I update my shader?

In Unity's Shader Graph how do you access parameters from code?

I recently rewrote a shared I was using into Shader Graph. As an example I carried out the color as an external parameter.

In my traditional shader to set the color I would call something like

MyMaterial.SetColor("_NewColor")

In the new code, I could not figure out the name of the parameter until I looked at the generated code. Turns out my Color parameter was actually named "Color_D027E98" So now my code is

MyMaterial.SetColor("Color_D027E98", color);

Not very pretty and I don't know how constant D027E98 is. Is this the correct way of changing a shader's parameter? Should I be doing something different using Shader Graph - Is this number going to change on me as if I update my shader?

Source Link
Andrey
  • 230
  • 2
  • 12

In unity's Shader Graph how do you access paramiters from code?

I recently rewrote a shared I was using into Shader Graph. As an example I carried out the color as an external parameter.

In my traditional shader to set the color I would call something like MyMaterial.SetColor("_NewColor")

In the new code i could not figure out the name of the paramiter until I looked at the generated code. Turns out my Color parameter was actually named "Color_D027E98" So now my code is
MyMaterial.SetColor("Color_D027E98", color);

Not very pretty and I don't know how constant D027E98 is. Is this the correct way of changing a shader's parameter? Should I be doing something different using Shader Graph. Is this number going to change on me as if I update my shader?