using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; using UnityEngine.UI; public class Announcementitem : MonoBehaviour { public Text neirong; public Text creatTime; public Announcement announcement; // Start is called before the first frame update public async void onclik() { GameObject prefab = Resources.Load("LLPrefabs/AnnouncementTongzhi"); Canvas canvas = GetComponentInParent(); Instantiate(prefab, canvas.transform); await Task.Delay(100); prefab.GetComponent().Announcement = announcement; } }