于是在物体下挂上测试脚本,只要脚本运行就会不断提示“运行中”
可见物体在SetActive(false)后,控制台依旧不断输出“运行中”
using System.Collections;
using UnityEngine;
public class ceshijiaoben : MonoBehaviour {
public int i=1;
void Start ()
{
InvokeRepeating("print", 2,1f);
}
void Update ()
{
}
void print()
{
while(true)
{
i++;
Debug.Log("运行中");
if (i > 100)
break;
}
}
}