
It looks like you're new here. If you want to get involved, click one of these buttons!
can someone tell me what is wrong with this code?
using UnityEngine;
public class PlayerColision : MonoBehaviour
{
public Player movement;
void OnCollisionEnter (Collision collisionInfo)
{
if (collisionInfo.collider.tag == "Enemies");
{
movement.enabled = false;
}
}
}
Answers
if (collisionInfo.collider.tag == "Enemies");
{
movement.enabled = false;
}
Where you declare the if statement
You don't need a semi colon!
The correct code is:
using UnityEngine;
public class PlayerColision : MonoBehaviour
{
public Player movement;
void OnCollisionEnter (Collision collisionInfo)
{
if (collisionInfo.collider.tag == "Enemies")
{
movement.enabled = false;
}
}
}
Thanks,
MrBaileyQ