using UnityEngine;
public class PlayerCollison :MonoBehaviour;
{
void OnCollisonEnter(Collison collisonInfo)
{
if (collisonInfo.collider.tag == “obstacle”);
{
Debug.Log(“We hit an obstacle”);
}
}
}
using UnityEngine;
public class PlayerCollison :MonoBehaviour;
{
void OnCollisonEnter(Collison collisonInfo)
{
if (collisonInfo.collider.tag == “obstacle”);
{
Debug.Log(“We hit an obstacle”);
}
}
}
This is an extremely low effort post. In the future, in the very least, please use code-tags .
The numbers in the brackets (3, 43) mean line 3, column 43. Look there, you’ll see a character that shouldn’t be there.
To note, you’re misspelling “collision” as “collison”. That won’t work for the callback you’ve typed.
You’ve placed semi-colons in locations that you shouldn’t (lines 3 and 8), and you’ve misspelled “collision”.
ChatGPT
It looks like there are some syntax errors in your script. I have corrected those for you:
using UnityEngine;
public class PlayerCollision : MonoBehaviour
{
void OnCollisionEnter(Collision collisionInfo)
{
if (collisionInfo.collider.tag == "obstacle")
{
Debug.Log("We hit an obstacle");
}
}
}
Here are the changes I made: