title: Save skill tree
body: <p>I have a problem with my skill tree. It is already complete, but I can't make it save, for other scenes etc., I use Binary Formatter to save, but whenever I pass the scene it doesn't continue.</p>
  <p>codes below:
  <a href="https://pastebin.com/mcWAqw0x" rel="nofollow noreferrer">https://pastebin.com/mcWAqw0x</a>
  <a href="https://pastebin.com/VEt7eiiE" rel="nofollow noreferrer">https://pastebin.com/VEt7eiiE</a></p>
  <pre><code>using System.Collections ;
  using System.Collections.Generic ;
  using UnityEngine ;
  using System ;
      
   
  public class PlayerSkills
  {
      public event EventHandler OnSkillPointsChanged ;
      public event EventHandler &lt; OnSkillUnlockedEventArgs &gt; OnSkillUnlocked ;
      public class OnSkillUnlockedEventArgs : EventArgs
      {
          public SkillType skillType ;
      }
   
      public enum SkillType
      {
          Nenhum,
          Soco,
          PunchC,
          PunchNC,
          Bola fogo,
          FireballC,
          FireballNc,
          Atordoar,
          StunC,
          StunNC,
          Def,
          DefC,
          DefNC,
          Pleh,
          PlehUp,
      }
   
     
      public list &lt; SkillType &gt; unlockedSkillTypeList ;
      public int skillPoints ;
     
     
      public PlayerSkills ( )
      {      
   
          unlockedSkillTypeList = new List &lt; SkillType &gt; ( ) ;
         
      }
   
      public void AddSkillPoints ( )
      {
          skillPoints ++;
          OnSkillPointsChanged ?. Invoke ( this , EventArgs . Empty ) ;
      }
   
      public int GetSkillPoints ( )
      {
          return skillPoints ;
      }
      public void UnlockSkill ( SkillType skillType )
      {
          if ( ! IsSkillUnlocked ( skillType ) )
          {
              unlockedSkillTypeList . Adicionar ( skillType ) ;
              OnSkillUnlocked ?. Invoke ( este , novo OnSkillUnlockedEventArgs { skillType = skillType } ) ;          
          }
       
      }
   
   
      public bool IsSkillUnlocked ( SkillType skillType )
      {
          return unlockedSkillTypeList . Contém ( skillType ) ;      
      }
      public SkillType GetSkillRequeriment ( SkillType skillType )
      {
          switch ( skillType ) {
              caso SkillType . PunchC : retorna SkillType . Soco ;
              caso SkillType . PunchNC : retorna SkillType . Soco ;              
              caso SkillType . FireballC : retorna SkillType . Bola de fogo ;    
              caso SkillType . FireballNc : retorna SkillType . Bola de fogo ;
              caso SkillType . StunC : retorna SkillType . Atordoar ;
              caso SkillType . StunNC : retorna SkillType . Atordoar ;
              caso SkillType . DefC : retorna SkillType . Def ;
              caso SkillType . DefNC : retorna SkillType . Def ;
              caso SkillType . PlehUp : retorna SkillType . Pleh ;
             
          }
          return SkillType . Nenhuma ;
         
      }
      public bool CanUnlock ( SkillType skillType )
      {
          SkillType skillRequiremente = GetSkillRequeriment ( skillType ) ;
   
          if ( skillRequiremente ! = SkillType . Nenhum )
          {
              if ( IsSkillUnlocked ( skillRequiremente ) )
              {          
                  return true ;
              }
              else
              {
                  retornar false;
              }
          }
          else
          {
              return true ;
          }
      }
   
     
      public bool TryUnlockSkill ( SkillType skillType )
      {
          if ( CanUnlock ( skillType ) )
          {
              if ( skillPoints &gt; 0 )
              {
                  skillPoints -;
                  OnSkillPointsChanged ?. Invoke ( this , EventArgs . Empty ) ;
                  UnlockSkill ( skillType ) ;
                  return true ;
              }
              else
              {
                  return false;
              }
             
             
          }
          else
          {
              return false;
          }
         
      }
   
  </code></pre>