(4,1): error CS1525: Unexpected symbol `int'


#1

using UnityEngine;

int n2 = 0;
int n = 0;

public class Playercollision : MonoBehaviour
{

void Update()
{
    n = Random.Range(-100, 100);
    n2 = Random.Range(-100, 100);
}
void OnCollisionEnter (Collision collisionInfo)
{
    if (collisioninfo.colider.tag == "obstical")
    {
        rb.AddForce(n,n2,0);


    }
}

}


#2

int n2 = 0;
int n = 0;

Should be placed inside your public class.


#3

Thank you so much my I was having troubles with a lot of simple things that I just could not think of how to fix. I am also a noob XD so I don’t really know much about where stuff is supposed to be.