Question by
mike1233 · Feb 04, 2017 at 12:16 PM ·
scripting problemcollider2dontriggerenteroncollisionenter
4 line code not working!
this code is not working
javascript and 2d it looks fine but it has error and wont play
im getting error;
Assets/water/belowg.js(25,7): BCE0005: Unknown identifier: 'coll'.
#pragma strict
function OnTriggerEnter2D(other: Collider2D) {
if (coll.gameObject.tag == "Wall")
Application.LoadLevel("Menu");
}
Comment
Answer by HenryStrattonFW · Feb 04, 2017 at 01:06 PM
This is because you have no variable in scope defined as "coll" your Collider2D parameter is being defined as "other" so you would need to use
if( other.gameObject.tag == "Wall" )