using System.Collections; using System.Collections.Generic; using UnityEngine; public class KillfeedMgr : MonoBehaviour { public static KillfeedMgr instance; public GameObject prefab; public Transform entryParent; public List pool = new List(); public float entryAliveTime = 1; void Awake(){ instance=this; } void Start(){ // AddNewEntry("Welcome to UPF Minigame 1.2"); } public void AddNewEntry(string message){ return; for(int i =0; i < pool.Count; i++){ if(!pool[i].gameObject.activeSelf){ pool[i].SetEntry(message,entryAliveTime); return; } } //No pooled item found, make new GameObject newEntry = Instantiate(prefab, entryParent); pool.Add(newEntry.GetComponent()); newEntry.GetComponent().SetEntry(message,entryAliveTime); } }