I have written a simple c# class that is supposed to change the color of the Player Renderer. But, there seems to be a problem! whenever I call the function OnCallFun() ... the color stays put and does not change. I have looked into the solution for quite some time now but no hope. does anyone have a solution?
using UnityEngine;
public class ChangeColor : MonoBehaviour
{
// Reference to Sprite Renderer component
private Renderer rend;
[SerializeField]
private Color colorToTurnTo = Color.white;
// Use this for initialization
void Start()
{
rend = GetComponent<Renderer>();
// Change sprite color to selected color
rend.material.SetColor("_SpecColor", colorToTurnTo);
}
}