Quantcast
Channel: Answers for "how to detect if one object is touching another"
Viewing all articles
Browse latest Browse all 8

Answer by Alzander2001

$
0
0
This is what i used for the next level portal: void OnTriggerEnter2D(Collider2D other) { if(other.gameObject.tag == "Player") { DontDestroyOnLoad(other.gameObject); Application.LoadLevel("ENTER LEVELNAME HERE"); } } This is C# and sorry about that. You must also tag the player as "Player". What this is doing is running this function whenever anything touches it, and if the tag is "Player" it will load the selected level. P.S If you have a 3D game, just Change "OnTriggerEnter2D" to "OnTriggerEnter", and change "Collision2D" To "Collision". Thanks! -Alec

Viewing all articles
Browse latest Browse all 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>