0 votes

So I have a fixed shader, and I want it's color to change when I do something. (Like hit key I or something.) However Fixed_Material doesn't have a set_diffuse function.

So how does one change the Diffuse Color in gdscript.

Here's what I've done so far.

func _ready():
    shader = FixedMaterial.new()
    FixedMaterial.new().???
    set_material_override(shader)
in Engine by (260 points)

1 Answer

0 votes

Use set_parameter with PARAM_DIFFUSE. For example:

func _ready():
    var material = FixedMaterial.new()
    material.set_parameter(FixedMaterial.PARAM_DIFFUSE, Color(1.0, 0.0, 0.0))
    set_material_override(material)

Check the FixedMaterial docs for more parameters.

by (1,552 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.