hello all i am bit new to scripting in unity. im having a small issue, i want to specific effect when i hit a specific gameobject with a tag. from my code i want to shift from 1st player to second when i hit a game object with a tag 'switch' but when i do it im getting null reference expected error
please help me in fixing it
thanks in advance ...!
if (Input.GetMouseButtonDown (0))
{
if (Physics.Raycast (ray, hit, 100))
{
switchPlayer1 = ! switchPlayer1;
if (hit.collider.gameObject.tag == "switch")
{
switchPlayer1 = true;
}
}
}
↧