Skip to content

Instantly share code, notes, and snippets.

@bricef
Created April 20, 2015 15:51
Show Gist options
  • Save bricef/9d94c1d9dd7e41c9d7b2 to your computer and use it in GitHub Desktop.
Save bricef/9d94c1d9dd7e41c9d7b2 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class ChangeOnCollision : MonoBehaviour {
private Material myMaterial;
// Use this for initialization
void Start () {
myMaterial = GetComponent<Renderer>().material;
}
void onTriggerEnter(Collider other){
myMaterial.color = Color.red;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment