1using UnityEngine;
2public class PlayerCollision : MonoBehaviour {
3 public PlayerMovement movement;
4 }
5void OnCollisionEnter(Collision collisionInfo)
6{
7UnityEngine.Debug.Log(collisioninfo.collider.name);
8{
9UnityEngine.Debug.Log(“we hit an obstacle”);
10}
11{
12if (collisionInfo.collider.tag) (“obstacle”);
13}
14}
15}
Assets\PlayerCollision.cs(6,6): error CS0116: A namespace cannot directly contain members such as fields or methods
Ok but what do you want help with? Getting the groceries out of your car?
oh lol sorry
Assets\PlayerCollision.cs(6,6): error CS0116: A namespace cannot directly contain members such as fields or methods
thats the error
You’re closing out your class on line 4. Then all the methods after that are just floating in the namespace, which doesn’t make sense, as your error message is saying. Put the methods inside the class.
PraetorBlue:
You’re closing out your class on line 4. Then all the methods after that are just floating in the namespace, which doesn’t make sense, as your error message is saying. Put the methods inside the class.
wheni get rid of it it gives me loads of errors
Get rid of what?
Just move the closing brace from line 4 to the bottom of the file, then make sure you have a matching number of opening and closing braces