A namespace cannot directly contain mambers such as fields or methods...
I get this error, if i type in private Rigidbody rb;
and i really don't know what the problem is. i already did this in other scripts and it worked every time. Error Code: CS0116 PS.: it's a C# projekt
Answer by Commoble · Mar 15, 2017 at 07:18 PM
You have to declare it inside a class. Example:
public class SomeScriptClass : MonoBehaviour
{
private Rigidbody rb;
}
Answer by Mr12309BACHMMb · Mar 15, 2021 at 10:53 AM
(if U R using Visual Studio or VS) be careful that inside the brackets that start from ...class... { | | | }
U can see those vertical bar -> | (those vertical bars are helpful) look at those vertical bars from the beginning until the end (start from the beginning of the brackets) when U finish looking at the vertical bars -> | (when U reach the ending of -> |) U may see under it the ending of the bracket, erase it and rewrite it at the end of the script (HINT: write everything except using, class, #if, #elif... inside a bracket -> ...class... { | | | }
)
Your answer
Follow this Question
Related Questions
I have an error on a C# script @username 2 Answers
Nav Mesh Problem with SetDestination 1 Answer
NameSpace player health 1 Answer
I Have an C# error and I can't fix it @username 1 Answer
Error stage @username 1 Answer