当前位置:网站首页>Unity3d: script execution sequence on scene loading gameobejct
Unity3d: script execution sequence on scene loading gameobejct
2022-07-23 12:52:00 【Sixi Liyu】
scene 1 Script
public class LoadScene1 : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
StartCoroutine(StartScene());
}
IEnumerator StartScene()
{
AsyncOperation aync = SceneManager.LoadSceneAsync("LoadScene2", LoadSceneMode.Additive);
while (aync.isDone == false)
{
Debug.Log(aync.progress);
yield return null;
}
Debug.Log("LoadOK");
yield return null;
}
}
scene 2 Mount on an object
public class LoadScene2 : MonoBehaviour
{
private void Awake()
{
Debug.Log("Awake");
}
// Start is called before the first frame update
void Start()
{
Debug.Log("Start");
}
private void OnEnable()
{
Debug.Log("OnEnable");
}
private void Update()
{
Debug.Log("Update");
}
}
scene 2 Screenshot 
Output after execution 

You can see , load LoadScene2 complete , Will execute LoadScene2 All in GameObject Of Awake,OnEnable,Start, and update Will execute once , After loading the scene
therefore , When optimizing scene loading , The code level focuses on the inherent in the new scene GameObject The complexity of executing logic in the script
边栏推荐
- Learning diary - (routing and switching technology) ACL access control list
- Unity3d:UGUI源碼,Rebuild優化
- 0动态规划 LeetCode918. 环形子数组的最大和
- Explain TCP segmentation and IP fragmentation in detail
- Hcip - first experiment
- PDF Online preview, use of pdf.js
- Unity3d:ugui source code eventsystem input system FAQ
- 浅析互联网协议(一)
- Instant messaging websocket
- Unity shader missing problem
猜你喜欢
随机推荐
Understand the article frankly and get the HTTP protocol cache
OSPF综合实验
Analyze redis cluster
Take go language as an example to explain [performance analysis] by analogizing detective reasoning
Hcip --- mGRE comprehensive experiment
HCIP---BGP相关配置
前缀和 LeetCode2100. 适合打劫银行的日子
[AUTOSAR storage stack NVM]
Analysis of inheritablethreadlocal and Alibaba's transmittablethreadlocal design ideas
Unity3d+GameFramework:资源分析,资源依赖,循环依赖检测
In depth analysis of replication in redis
深度优先找出图中顶点U到顶点V的所有简单路径
学习日记(路由与交换技术)——浮动静态路由和缺省路由
post表单提交数据限制
Design experience of log file IO system
详解TCP的流量控制机制与拥塞控制机制
[database] basic theory
【数据库】基础理论
浅析互联网协议(一)
浅析互联网协议(二)
![[AUTOSAR DCM 1. module introduction (DSL, DSD, DSP)]](/img/99/55b3162ad061fbd00145d0b6810592.png)








