Unity 对运行顺序,整体架构的理解,初学
来源:互联网 发布:淘宝开店不知道卖什么 编辑:程序博客网 时间:2024/05/07 03:19
- 为一个场景对象添加上三个脚本,在场景开始运行时,脚本中的Start方法将会按照脚本添加的顺序来依次运行,而Update方法却是完全相反
比如:有A1、A2、A3三个脚本,它们的添加顺序是A1、A3、A2,那么在场景运行时,程序运行顺序是A1.Start()、A3.Start()、 A2.Start()、A2.Update()、A3.Update()、A1.Update()……,即使A1.Start()或A2.Update ()运算时间超过其它的方法,那么其它的方法也会等待其运行完成后才会开始运行之……
下面是三个脚本文件的例程:
jxxh01.cs- using UnityEngine;
- using System.Collections;
- public class jxxh01 : MonoBehaviour
- {
- // Use this for initialization
- void Start()
- {
- for (int temp02 = 0; temp02 < 5; temp02++)
- {
- for (int temp01 = 0; temp01 < 5; temp01++)
- {
- int a01 = 0;
- for (int temp = 0; temp < 50000; temp++)
- {
- a01++;
- a = a01;
- }
- a01 = 0;
- }
- }
- print(Time.time + " This is jxxh01 : " + a);
- }
- public int ForValue=10000;
- int a = 0;
- // Update is called once per frame
- void Update () {
- for (int temp = 0; temp < ForValue; temp++) { a = temp; }
- print(Time.time + " This is jxxh01 : " + a);
- }
- }
jxxh02.cs- using UnityEngine;
- using System.Collections;
- public class jxxh02 : MonoBehaviour
- {
- // Use this for initialization
- void Start()
- {
- for (int temp = 0; temp < 10000; temp++)
- {
- a++;
- }
- print(Time.time + " This is jxxh02 : " + a);
- }
- public int ForValue = 100;
- int a = 0;
- // Update is called once per frame
- void Update () {
- print(Time.time + " This is jxxh02 : " + a);
- }
- }
jxxh03.cs- using UnityEngine;
- using System.Collections;
- public class jxxh03 : MonoBehaviour
- {
- // Use this for initialization
- void Start()
- {
- for (int temp = 0; temp < 10000; temp++)
- {
- a++;
- }
- print(Time.time + " This is jxxh03 : " + a);
- }
- public int ForValue = 100;
- int a = 0;
- // Update is called once per frame
- void Update () {
- print(Time.time + " This is jxxh03 : " + a);
- }
- }
0 0
- Unity 对运行顺序,整体架构的理解,初学
- 对linux字符设备的理解(整体架构)
- 对linux字符设备的理解(整体架构)
- 初学java对java的调用顺序的理解
- vlc源码的整体架构初步理解
- Ambari 整体架构理解
- 个人对magento整体的理解
- 对Linux内存管理的整体理解
- 对linear classifier 的整体理解
- 对Hbase的整体理解结构图
- 对Tensorflow整体的理解介绍
- 初学java,对3+1层架构的一些简单理解:MVC+S
- 深入理解Unity脚本的执行顺序
- 深入理解Unity脚本的执行顺序
- 初学对MVC的理解和疑问...
- 初学STM32对AFIO的简单理解
- 初学 iOS 对icon的理解
- 初学java对一些基本概念的理解
- MySQL-1-安装
- opencv中cvmat的通道学习
- 2013 duilib入门简明教程 -- 界面设计器 DuiDesigner (10)
- Unity与android开发——一款神奇的工具
- windows7 64位 mini2440开发板 USB驱动安装
- Unity 对运行顺序,整体架构的理解,初学
- linux find -exec 用法
- 内部类
- Unity基本知识点的掌握
- 2013 duilib入门简明教程 -- 部分bug (11)
- ZOJ Problem Set - 3702 Gibonacci number
- Github实例教程-创建库、创建主页
- 2013 duilib入门简明教程 -- 简单控件介绍 (12)
- Java 内部类种类及使用解析