I want to change the base color of my mesh when I press TAB.
The script:
var color1 = Color(0.3,0.3,0.3,1)
func input(event):
if Input.iskeypressed(KEYTAB):
color1 = getnode("InterfaceRoot/TabCColors/CPMesh").getpick_color()
The problem:
The MeshInstance's mesh can be changed in my game. If I change mesh and then press TAB to change the color, it basically says the material no longer exists. I suppose this happens because when you change the mesh, you lose the material applied to it. Problem is, I can't successfully create a new material, not even copy-pasting from tutorials on the web. Also, results are variable. For example, if I don't change mesh and material I set by hand to be the default (a cube with a basic material) it works smoothly.
I'm an absolute beginner of Godot and GDScript so please try to be basic in your answer! Thanks to everyone! :)