title: Null reference exeption when I try to call an instanced object
body: <p>My question probably comes from a bad understanding of inheritance and composition. I have a couple of classes with inheritance BasePlayerClass=>SpaceShipClass=>SpaceShipObject. I dont understand how to call the instantiated class Player from another classes, so that it saves its properties and doesn't get the null value.</p>
  
  <pre><code>public class CreatePlayer : MonoBehaviour
  {
  
  
      public Sprite SCALPEL, WARPER, ORION;
      public SpriteRenderer SelectedCharacterSprite;
      public Skill_Slot newSkillslot;
  
      private readonly string SelectedCharacter = null;
  
  
  
  
  
  public void Start()
  {
    PlayerCreation();
  
    newSkillslot.CreateSkillSlots();
  
  }
  
  public void PlayerCreation()
  {
  BasePlayerClass player = new BasePlayerClass();
  SelectedCharacterSprite = this.GetComponent&lt;SpriteRenderer&gt;();
      int getCharacter = PlayerPrefs.GetInt(SelectedCharacter);
  
          switch(getCharacter){
  
              case 0:
              SelectedCharacterSprite.sprite = SCALPEL;
              player.SpaceshipClass = new ScalpelSpaceship();
              break;
              case 1:
              SelectedCharacterSprite.sprite = WARPER;
              player.SpaceshipClass = new WarperSpaceship();
              break;
              case 2:
              SelectedCharacterSprite.sprite = ORION;
              player.SpaceshipClass = new OrionSpaceship();
              break;
  
          }
  }
  }
  
  
  
  
  
  public class Skill_Slot : MonoBehaviour
  {
     public Skill SignedSkill;
     private Image qImg;
     private Image wImg;
     private Image eImg;
  
  
  
      public GameObject qSkillSlot;  
      public GameObject wSkillSlot;
      public GameObject eSkillSlot;
  
      public BasePlayerClass player;
  
  
  
  
  
  
  
     public void CreateSkillSlots()
     {
        Debug.Log(player.SpaceshipClass);
        qImg = qSkillSlot.GetComponent&lt;Image&gt;();
        wImg = wSkillSlot.GetComponent&lt;Image&gt;();
        SignedSkill = player.SpaceshipClass.QSkill;
  
        switch(player.SpaceshipClass.QSkill.SkillIndex){
          case 1:
          qImg.sprite = Resources.Load&lt;Sprite&gt;("BasicAttack");
          SignedSkill = player.SpaceshipClass.QSkill;
          break;
          case 2:
          qImg.sprite = Resources.Load&lt;Sprite&gt;("OrionMove");
          break;
          case 3:
  
          break;
  
     }
     switch(player.SpaceshipClass.WSkill.SkillIndex){
          case 1:
          wImg.sprite = Resources.Load&lt;Sprite&gt;("BasicAttack");
          break;
          case 2:
          wImg.sprite = Resources.Load&lt;Sprite&gt;("OrionMove");
          SignedSkill = player.SpaceshipClass.WSkill;
          break;
          case 3:
  
          break;
  
     }
  }
  }
  </code></pre>