I downloaded some characters here: Unity Asset Store - The Best Assets for Game Making
I created a prefab out of them and I am creating copies of them in my game. I’d like to highlight one of them at a particular time (i.e. change their color when it is their turn). Since it’s based on turn, it needs to be done programatically.
The prefab is soldier
and has a soldier_Military_Male_Lod_1
in its directory that has a shader. I can change the color of that shader manually or while previewing the game, but I’m not sure how to access it from within the script.
Seems like I would use GetComponentsInChildren
, but the name of the shader component is Soldier_D_1024_alt
, and I’m not sure how to reference this in the script.
How can I programmatically highlight / change the shader color of a prefab with its shader in its children?