title: How do I call an variable from another class in C#
body: <p>I come from Java and I'm picking up C# scripting, I've had this issue for around two days now looking for solutions, I've tried setting the class to an instance and everything. This is for a miniature game project that I am working on with some friends.</p>
  
  <p>Either way, I have StatHandler.cs which handles all of our statpoints... then I have HealthManager.cs which is supposed to handle all of the Health Related stuff.</p>
  
  <p>The problem is, I can't for the life of me figure out how to call the variables such as </p>
  
  <pre><code>public int stamina, strength, agility, dexterity, wisdom;
  </code></pre>
  
  <p>from StatHandler.cs</p>
  
  <p>I know that in Java it would be as easy as</p>
  
  <pre><code>maxHealth = StatHandler.stamina * 10;
  </code></pre>
  
  <p>Although, you cannot do that with C#, when creating an instance the code looks like this</p>
  
  <pre><code>maxHealth = StatHandler.instance.stamina * 10;
  </code></pre>
  
  <p>which provides me with the error</p>
  
  <pre><code>NullReferenceException: Object reference not set to an instance of an object
  </code></pre>
  
  <p>I've also tried inherriting, by doing this</p>
  
  <pre><code>public class HealthHandler : StatHandler {
  </code></pre>
  
  <p><strong>but it sets all the values to 0 in the HealthHandler class, it doesn't read anything.</strong> </p>
  
  <hr>
  
  <p>I really just need to figure out how to pull the variable from the other C# files, because this is slowing me way down.</p>