I've got two classes, one called Simulation, another called Star shown below:
public class Simulation
{
public static Simulation simulationInstance;
public void test()
{
Debug.Log("test");
}
}
public class Star
{
public void test2()
{
Sim.simulationInstance.test();
}
}
I'm trying to call the test() method in Simulation from the test2() method in Star.
But this returns an error:
NullReferenceException: Object reference not set to an instance of an object
Pointing to this line:
Sim.simulationInstance.test();
What am I doing incorrectly, and how do I fix this?