- Edited
I'm having a hard time figuring out how to change instancing colors, linking mesh model properties to change material albedo. Then do different actions on that object depending on it's instance color. WhitePawn is my kinetic object and Pawnmtl is my mesh it's attached to. I'm using GD-script. Any help would be much appreciated.
Something similar to what I'm trying to do... https://godotforums.org/discussion/21600/is-there-a-way-to-change-what-material-an-object-is-using-using-a-script
extends Spatial
onready var spawner_white_pawn = preload("res://scenes/WhitePawn.tscn")
func _ready() -> void:
var b1 = spawner_white_pawn.instance()
b1.set_translation(Vector3(0,5,0))
b1.get_node("WhitePawn/Pawnmtl")
mat = b1.get_surface_material(0)
mat.set_albedo() = color() #error can't assign to expression
add_child(b1)
#Pawnmtl
extends MeshInstance
func _ready():
var to_mesh = get_node("WhitePawn/Pawnmtl")
mat = to_mesh.get_surface_material(0) #error The identifier "mat" isn't declared in current scope