So I’m quite new to coding but I wrote a script for my platform game object so that when you jump off the platform is destroyed. I’m getting the error:
(25,8): error CS0103: The name `col’ does not exist in the current context
and here is the script:
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown ("space") && onPlatform == 1)
{
Destroy(gameObject);
onPlatform = 0;
}
}
void OnCollisionEnter2D(Collision2D coll)
{
if(col.gameObject.name == "Player")
{
onPlatform = 1;
}
else
{
onPlatform = 0;
}
}
}