Hello everyone,
I have this code( C# ) that should allow me to press a texture, and it would change the color of my object. But it does not work … and I have no error message. Do you have any idee ?
using UnityEngine;
using System.Collections;
public class couleur : MonoBehaviour {
public Color shader;
public Texture texture;
void OnGUI ()
{
Rect rect = new Rect(10,10,100,100);
GUI.DrawTexture(rect,texture);
if(rect.Contains(Input.mousePosition) (Input.GetMouseButtonDown(0)))
{
renderer.material.color = shader;
}
}
}