private void GenerateTechPanels()
 {
     technologyButtons = new List <TechnologyButton>();
     foreach (Technology technology in technologies)
     {
         TechnologyButton button = Instantiate(technology.researchUIPrefab, panelParent).GetComponent <TechnologyButton>();
         button.technology = technology;
         button.name       = technology.displayName;
         button.SetTechnology(technology);
         technologyButtons.Add(button);
     }
 }
Пример #2
0
    public override void OnInspectorGUI()
    {
        // Set editable fields
        TechnologyButton component = (TechnologyButton)target;

        component.associatedTechnology = (Technology)EditorGUILayout.ObjectField("Associated Technology",
                                                                                 component.associatedTechnology,
                                                                                 typeof(Technology), true);

        component.technologyImage = (Image)EditorGUILayout.ObjectField("Technology Image",
                                                                       component.technologyImage,
                                                                       typeof(Image), true);

        // Then, set the Technology Image as the central image of this button
        component.technologyImage.sprite = component.associatedTechnology.technologySprite;
        base.OnInspectorGUI();
    }