title: Call a method from another class
body: <p>I'm wanting to know how I can call a method from another class without having to make a new instance of that class. I've looked up this and 90% of the examples I see require me to make a new copy of my referenced class. </p>
  
  <p>Something like this: </p>
  
  <pre><code>Fooclass test = new Fooclass();
  test.CallMethod();
  </code></pre>
  
  <p>However, I'm wondering if there is a way I can call the method without making a new class instance. Right now I've tried the following in unity.</p>
  
  <pre><code>public ImageLoader image; 
  void Start () 
  {
      image = gameObject.GetComponent&lt;ImageLoader&gt;() as ImageLoader;
  }
  
  void OnClick()
  {
      image.MoveForward();
  }
  </code></pre>
  
  <p>however, when I run this I get the following error:</p>
  
  <blockquote>
    <p>NullReferenceException: Object reference not set to an instance of an object</p>
  </blockquote>
  
  <p>i know this would be settled with making a new instance of my image loader class but I can't do that as it is holding a lot of data I don't want duplicated multiple times. </p>