Skip to content

Instantly share code, notes, and snippets.

@kaorun55
Created June 22, 2016 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaorun55/6ef1b1e5fbd40407c8cb9e7683e1a7bb to your computer and use it in GitHub Desktop.
Save kaorun55/6ef1b1e5fbd40407c8cb9e7683e1a7bb to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class CubeCommand : MonoBehaviour {
public Material first;
public Material second;
public void OnSelect()
{
Debug.Log("OnSelect");
var material = GetComponent<Renderer>().material;
GetComponent<Renderer>().material = (material.color == first.color) ? second : first;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment