Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using UnityEngine;
using System.Collections;
public class CubeCommand : MonoBehaviour {
public Material first;
public Material second;
public void 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