Created
January 23, 2016 00:43
-
-
Save moon-goon/3bbdb01d5788479dbe1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnCollisionEnter(Collision target) { | |
// create a gameobject (a cube for this demo) name it "enemy" | |
// and your argument(target) is setup so that object can be collided with | |
if (target.gameObject.name == "enemy") { | |
// Change the player's color to green when collide occurs | |
gameObject.GetComponent<Renderer>().material.color = Color.green; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment