Changing the albedo color of a suface shader in an instanced mesh without affecting all the meshs

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

So I have a character type and I want to just simply change the colors of the albedo to differentiate the characters from one another. However, when I try to change the albedo_color. It changes it for all the instanced character.

Is there a way to only change one specific instanced characters materials settings?

:bust_in_silhouette: Reply From: Magso

Materials are shared resources. You need to make a new material either by duplicating the current material or creating a new material resource in a script and assigning it as the material.

var new_material = SpatialMaterial.new()
new_material.set_albedo(color)
MeshInstance.set("material/0", new_material)

Thank you for the explaination.

Dumuz | 2020-04-18 02:07