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