private void Update()
 {
     if (this.enabled)
     {
         if (selectedGameobject == null)
         {
             currentGameObjectScript = selectedGameobject.GetComponentInParent <ResourceBuildingsManagment>();
         }
         if (currentGameObjectScript != selectedGameobject.GetComponentInParent <ResourceBuildingsManagment>())
         {
             currentGameObjectScript = selectedGameobject.GetComponentInParent <ResourceBuildingsManagment>();
         }
         else
         {
             if (!ObjectName.Equals(currentGameObjectScript.ChildBuildingTyp.BuildingTyp))
             {
                 ObjectName = currentGameObjectScript.ChildBuildingTyp.BuildingTyp;
                 this.transform.Find("BuildingName").GetComponent <TextMeshProUGUI>().SetText(ObjectName);
             }
             if (!StortedResources.Equals(currentGameObjectScript.StoredResources))
             {
                 StortedResources = currentGameObjectScript.StoredResources[currentGameObjectScript.ChildBuildingTyp.ResourceToGather[GrabTheResourceWithTheLargesValue()]];
                 this.transform.Find("StortedResources").GetComponent <TextMeshProUGUI>().SetText(ResourceWithTheHighestAmount + ": " + StortedResources.ToString());
             }
             if (!ProduktionSpeed.Equals(currentGameObjectScript.ProduktionSpeed))
             {
                 ProduktionSpeed = currentGameObjectScript.ProduktionSpeed;
                 this.transform.Find("ProduktionSpeed").GetComponent <TextMeshProUGUI>().SetText(ProduktionSpeed.ToString());
             }
             if (!WorkingPeopleCapacity.Equals(currentGameObjectScript.WorkingPeopleCapacity))
             {
                 WorkingPeopleCapacity = currentGameObjectScript.WorkingPeopleCapacity;
             }
             if (!WorkingPeople.Equals(currentGameObjectScript.WorkingPeople))
             {
                 WorkingPeople = currentGameObjectScript.WorkingPeople;
                 this.transform.Find("WorkingPeople").GetComponent <TextMeshProUGUI>().SetText(WorkingPeople.ToString() + "/" + WorkingPeopleCapacity.ToString());
             }
             if (!GatheredResourcesOverall.Equals(currentGameObjectScript.GatheredResourcesOverall))
             {
                 GatheredResourcesOverall = currentGameObjectScript.GatheredResourcesOverall;
                 this.transform.Find("GatheredResourcesOverall").GetComponent <TextMeshProUGUI>().SetText(GatheredResourcesOverall.ToString());
             }
         }
     }
 }
 private void GetSelectedBuilding()
 {
     selectedBuilding = ResourceBuidlingOnClickUi.SelectedGameobject.transform.parent
                        .GetComponent <ResourceBuildingsManagment>();
     selectedBuildingCapacity = selectedBuilding.WorkingPeopleCapacity;
 }