I've been watching bergzerg arcade's hack & slash tutorial, and at the end of the 9th video he puts in a script that changes the default materials color. I'm using a custom model, with a custom texture/material. There are no errors in the script, and I have searched around on Unity Answers and google but I can't find anything that works. Thanks in advance!
Try this:
C#: mObjectName.gameObject.renderer.material.color = new Color(R, G, B, A);
JS: mObjectName.renderer.material.SetColor("_TintColor", Color(R, G, B, A));
Sprite spr = Resources.Load(“SpriteName”);
SpriteRenderer sprRenderer= (SpriteRenderer)renderer;
sprRenderer.sprite = spr;
public class ExampleClass : MonoBehaviour {
public Color colorStart = Color.red;
public Color colorEnd = Color.green;
public float duration = 1.0F;
public Renderer rend;
void Start() {
rend = GetComponent<Renderer>();
}
void Update() {
float lerp = Mathf.PingPong(Time.time, duration) / duration;
rend.material.color = Color.Lerp(colorStart, colorEnd, lerp);
}
}
//make it in javascript