Exemplo n.º 1
0
        private void OnEnable()
        {
            ObjectSelection.CategoryChanged += CategoryChanged;

            ObjectSelection.ClearList();
            PopulateList();
        }
Exemplo n.º 2
0
        private void PopulateList()
        {
            ObjectSelection.ClearList();

            var spawnablesByType = SpawnableManager.Prefabs.Where(x => x.Type == (Enumerations.SpawnableType)ObjectSelection.CurrentCategoryIndex).ToList();

            if (spawnablesByType.Any())
            {
                foreach (var spawnable in spawnablesByType)
                {
                    string displayText = string.IsNullOrEmpty(spawnable.MenuText) ? spawnable.Prefab.name.Replace("selectable", string.Empty) : spawnable.MenuText;
                    ObjectSelection.AddToList(displayText, spawnable.PreviewTexture, () => ObjectClicked(spawnable), () => ListItemSelected(spawnable));
                }

                if (ObjectSelection.ListContent.transform.childCount > 0)
                {
                    EventSystem.current.SetSelectedGameObject(ObjectSelection.ListContent.transform.GetChild(0).gameObject);
                }
            }
        }
Exemplo n.º 3
0
        private void OnDisable()
        {
            ObjectSelection.ClearList();

            ObjectSelection.CategoryChanged -= CategoryChanged;
        }