IngamePresetToggle CreateNewToggle() { GameObject toggleGO = Instantiate(togglePrefab, transform); IngamePresetToggle toggle = toggleGO.GetComponent <IngamePresetToggle>(); return(toggle); }
void Awake() { IngamePresetToggle toggle = CreateNewToggle(); toggle.Initialize(InGameSettings.ChangeFogOfWar, InGameSettings.FogOfWarEnabled, "Fog of War"); Input.IngamePreserMenuClick += OnIngamePresetMenuClick; gameObject.SetActive(false); }