Can't change color of child MeshInstance

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By navett52

I have a scene that’s supposed to mimic a planet. It’s current node setup is simply RigidBody > CollisionShape > MeshInstance. The arrows represent parent-child relationship. I have a script on the RigidBody where a color variable is exported so it can be changed via the editor. This is the _ready function of the script:

func _ready():
var material =
material.albedo_color = color
currentVelocity = initialVelocity

This is not working, for some reason. I’ve tried many combinations of selecting the mesh of the MeshInstance and changing the color of the material or doing what I’m doing now and setting the material of the mesh to a new one with the desired color altogether. I feel like changing the color should be this easy, but perhaps I’m missing something. Any help is greatly appreciated!

have the same problem. Any update on this? have you figured it out?

istemihan | 2021-05-22 11:50

Apologies I never saw a notif for this. I haven’t touched the project in quite some time since it was a for-fun thing. I wonder if Godot 4 fixed this.

navett52 | 2023-04-01 20:37