using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; namespace CartoonCoffeeFireVFX { public class DemoPreview : MonoBehaviour { public static DemoPreview c; Dictionary buttons; Transform currentCategory; Transform categoryParent; Text currentParticle; Text currentIndex; int index; Transform particleParent; void Awake() { c = this; buttons = new Dictionary(); currentParticle = transform.Find("Banner/CurrentText").GetComponent(); currentIndex = transform.Find("Banner/Count").GetComponent(); categoryParent = GameObject.Find("ParticleCategories").transform; for(int a = 0; a < categoryParent.childCount; a++) { Transform categoryTransform = categoryParent.GetChild(a); for(int b = 0; b < categoryTransform.childCount; b++) { Transform particleParent = categoryTransform.GetChild(b); if(particleParent.name == "Name") { Transform child = particleParent.GetChild(0); particleParent.name = child.name; } } } particleParent = transform.parent.Find("Particles"); GameObject catButton = transform.Find("Banner/CategoryButton").gameObject; for(int c = 0; c < categoryParent.childCount; c++) { Transform category = categoryParent.GetChild(c); GameObject newCatButton = Instantiate(catButton); newCatButton.GetComponent().text = category.name; newCatButton.transform.SetParent(catButton.transform.parent,false); newCatButton.GetComponent().anchoredPosition = new Vector2(25, -80 - 27 * c); Button button = newCatButton.GetComponent