-
-
Save mahdisml/b888dd6567209ce2203854c9b28895bf to your computer and use it in GitHub Desktop.
Example of OnCollisionEnter in Unity in c# from Unity 3d Student
This file contains 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 theCollision){ | |
if(theCollision.gameObject.name == "Floor"){ | |
Debug.Log("Hit the floor"); | |
}else if(theCollision.gameObject.name == "Wall"){ | |
Debug.Log("Hit the wall"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment