Unity游戏开发过程中使用的前后台切换技术
发布时间
阅读量:
阅读量
在某些情况下游戏可能需要从主界面转入后台运行以优化资源利用率。那么,在开发过程中如何实现这一功能呢?为了让读者更好地理解这个问题我们特意为大家进行了详细的讲解以便大家能够掌握相关技巧。对于不太熟悉的朋友来说也可以先学习一下基础内容然后逐步掌握操作方法
//simulateSwitchToBackground.cs
usingUnityEngine;
usingSystem.Collections;
usingSystem.Collections.Generic;
publicclass simulateSwitchToBackground : MonoBehaviour {
voidsendApplicationPauseMessage(boolisPause){
Transform[] transList= GameObject.FindObjectsOfType();
for(inti = 0; i < transList.Length; i++) {
Transform trans = transList [i];
//Note that messages will not be sent to inactive objects
全部评论 (0)
还没有任何评论哟~
