_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/lianghaoLL/Announcementitem.cs

23 lines
671 B
C#

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<GameObject>("LLPrefabs/AnnouncementTongzhi");
Canvas canvas = GetComponentInParent<Canvas>();
Instantiate(prefab, canvas.transform);
await Task.Delay(100);
prefab.GetComponent<AnnouncementTongzhi>().Announcement = announcement;
}
}