How do you use namespace functions?
I have a weird problem that no one seems to be talking about. I'm trying to use namespaces for my script mainly to see how it works but no matter how simple the function is it gives me a nullreferenceexception. heres a example
namespace namespaceExample
{
public class TestClass : MonoBehaviour
{
public void TestFunction(string message)
{
print(message);
}
}
}
class TestClass2
{
public string message = "Hello World!";
namespaceExample.TestClass test;
void Test()
{
test.TestFunction(message);
}
}
can someone explain to my why this happens? I'm using unity 2017.2.0f3
Comment
Answer by Techn0man · Dec 03, 2017 at 04:15 PM
The awnser is that you have to derive from the namespace and not monodevelop in the script that uses the name space :/
Your answer
Follow this Question
Related Questions
JsonUtilty not found 1 Answer
A namespace cannot directly contain mambers such as fields or methods... 2 Answers
C# cant find a class auto generated by unity 2 Answers
Creating public variables 1 Answer
Get All Unity Namespaces (string array) 0 Answers