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()
in Engine by (273 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))

Check the FixedMaterial docs for more parameters.

by (1,558 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 Frequently asked questions and 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 [email protected] with your username.