Thanks Harald,
I took a look at those examples and I do like how the Dark Color tint works using the Skeleton Tint shader.
When I use the MaterialPropertyBlock
to set the color, I really like how that looks compared to the flat red I was applying. Its looks good for the base unit, but the gear (the stuff in darker red) is still off when I set the slot color.
I went through each gear slot and manually set it to red, but the colors don't match.
public void ChangeColor()
{
mpb = new MaterialPropertyBlock();
mpb.SetColor("_Black", Color.red);
var mesh = GetComponent<MeshRenderer>();
mesh.SetPropertyBlock(mpb);
var skeletonComponent = GetComponent<ISkeletonComponent>();
foreach (Slot slot in skeletonComponent.Skeleton.Slots)
{
// _gearSlots is just a reference to each slot which can have a gear sprite attached, e.g. body armor
if (_gearSlots.Contains(slot))
{
slot.SetColor(Color.red);
}
}
}
I assume its because I am not setting the MaterialPropertyBlock
to get the same effect?
I am not that familiar with shaders (and it's the first thing I plan to learn in depth after I get this freaking game finished).
In order to fix this and have the attachments get the same coloring, do I need to get the mesh of the attachment (and how would I do that)? Or is there something else I need to do?
Thank you.
P.S. How do I change it back to no coloring after? I tried using Color.white but it changes it to white. [Update I was able to clear the mesh property block by setting it to null]