Hi all,
Firstly, can i say I’ve search the forums for this and have found many threads but i still can’t get it to work…
I am trying to alter the color of a material via code (i am using c#).
I have done the following but I’m not sure what to do now:
void Update () {
renderer.material.color.r = 1.0;
}
I have also tried and similars but to no effect:
renderer.material.SetColor ("_TintColor", Color);
Can anyone help as i’m new to scripting.
Also, I saw an example where the first line of code was:
myGameObject.renderer.material.color = Color.red;
If I create a script and add it to a specific gameobject, can i omit the myGameObject section and do i need to reference the material within the script or will ‘dragging it onto’ the gameObject sort this?
Apologies for the novice questions!!
Matt.