/// <summary>
 /// Reset after a level loads and apopulate variables.
 /// </summary>
 /// <param name="scene"></param>
 /// <param name="scenemode"></param>
 void OnLevelFinishedLoading(Scene scene, LoadSceneMode scenemode)
 {
     if (Reasourcesthing && reasourcestextmesh == null)
     {
         reasourcestextmesh = Reasourcesthing.GetComponent <TextMesh>();
     }
     if (GameObject.Find("Controllers") != null)
     {
         if (GameObject.Find("Controllers"))
         {
             unitcon = GameObject.Find("Controllers").GetComponent <UnitMovementcommandcontroller>();
         }
         if (GameObject.Find("CrossLevelVariables"))
         {
             crossvar = GameObject.Find("CrossLevelVariables").GetComponent <CrossLevelVariableHolder>();
         }
     }
     if (this != null && this.gameObject != null && scene.name != null)
     {
         this.gameObject.SetActive(false);
     }
     if (this != null && this.gameObject != null && UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex != 0 && UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex != 1 && SceneManager.GetActiveScene().buildIndex != 5 && SceneManager.GetActiveScene().buildIndex != 6)
     {
         unitcon  = GameObject.Find("Controllers").GetComponent <UnitMovementcommandcontroller>();
         crossvar = GameObject.Find("CrossLevelVariables").GetComponent <CrossLevelVariableHolder>();
     }
     if (Fighters != null)
     {
         Fighters.SetActive(true);
         Frigates.SetActive(true);
         Special.SetActive(true);
         if (crossvar.campaign == true)
         {
             if (crossvar.campaignlevel.shipsavaiable == MainMenuCampaignControlScript.eshipsavailable.fighers)
             {
                 Fighters.SetActive(true);
                 Frigates.SetActive(false);
                 Special.SetActive(false);
             }
             else if (crossvar.campaignlevel.shipsavaiable == MainMenuCampaignControlScript.eshipsavailable.frigates)
             {
                 Fighters.SetActive(true);
                 Frigates.SetActive(true);
                 Special.SetActive(false);
             }
             else if (crossvar.campaignlevel.shipsavaiable == MainMenuCampaignControlScript.eshipsavailable.all)
             {
                 Fighters.SetActive(true);
                 Frigates.SetActive(true);
                 Special.SetActive(true);
             }
         }
     }
 }
 /// <summary>
 /// Update the Reasource count.
 /// </summary>
 void Update()
 {
     if (Reasourcesthing)
     {
         if (unitcon == null)
         {
             unitcon = GameObject.Find("Controllers").GetComponent <UnitMovementcommandcontroller>();
         }
         if (reasourcestextmesh == null)
         {
             reasourcestextmesh = Reasourcesthing.GetComponent <TextMesh>();
         }
         if (unitcon)
         {
             reasourcestextmesh.text = "Resources : " + unitcon.getmoney();
         }
     }
 }