0 votes

If I use the color change function at startup, everything works. And if I send a signal that should do this function, it does it, but the color does not change.

Here is my code. (This object is prefab)

extends Spatial


onready var tween := $Tween
var colors:Array = [Color.white, Color.red, Color.orange, Color.green, Color.aqua, Color.blueviolet]
var stat:int = 0
var is_merge:bool = false



func _ready():
    $"..".connect("spawn", self, "_on_Bomb_spawn")
    $"..".connect("set_color", self, "_set_color")
    tween.interpolate_property($".", "translation:y", 2, 1.4, 0.2)
    set_color()


func set_color() -> void:
    $BombMesh.get_surface_material(0).albedo_color = colors[stat]



func _set_color() -> void:
    set_color()
Godot version 3.3.3
in Engine by (27 points)

1 Answer

0 votes

I myself solved this problem by typing. You need to check the box here.
https://imgur.com/a/UtS6GjR

by (27 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.