基于Coroutine技术实现的Unity游戏框架中的并行任务暂停机制
发布时间
阅读量:
阅读量
无需过多赘述,以下将通过一个简单的示例来说明如何利用coroutine实现程序执行的暂停操作。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TextTriggered : MonoBehaviour
{
public GameObject TextObject;
// Start is called before the first frame update
void Start()
{
TextObject.SetActive(false);
}
private void OnTriggerEnter(Collider other)
{
// debug
// Debug.Log("the player triggered");
// if the player is nearby, show the message on the screen
if(other.gameObject.tag == "Player")
全部评论 (0)
还没有任何评论哟~
