hello,
I want to change the object material when click on object,i make this script in c# below but it change between two materials only and i want to change among three material as the third are not work,so what is the wrong with this
using UnityEngine;
using System.Collections;
public class oo : MonoBehaviour {
// put the first material here.
public Material logo;
// put the second material here.
public Material material2;
// put the third material here.
public Material material3;
bool FirstMaterial = true;
bool SecondndMaterial = false;
bool SecondndMaterial3 = false;
void Start ()
{
renderer.material = logo;
}
void OnMouseDown()
{
if (FirstMaterial)
{
renderer.material = material2;
SecondndMaterial = true;
FirstMaterial = false;
SecondndMaterial3 = false;
}
else if(SecondndMaterial)
{
renderer.material = logo;
FirstMaterial = true;
SecondndMaterial = false;
SecondndMaterial3 = false;
}
else if(SecondndMaterial3)
{
renderer.material =material3 ;
SecondndMaterial3 = true;
FirstMaterial = false;
SecondndMaterial = false;
}
}
}