当前位置:网站首页>Script lifecycle
Script lifecycle
2022-07-06 04:05:00 【A plum in fall】
List of articles
Preface
MonoBehaviour Class defines a script file to be loaded from the beginning , To the final destruction of a complete process . This process , Through corresponding methods , Perform functions that cannot be done in different ways .
We call these methods : Methods related to script life cycle .
One 、 Initialize the relevant methods
Awake()
Called automatically when the script is loaded into the scene
Only execute once in the whole life cycle
OnEnable()
Called when the object becomes available or active , Determine whether the object or script is available
coordination OnDisable() Methods used together
The number of executions is uncertain
Start()
for the first time Update Previous call
Only execute once in the whole life cycle , Used for initialization
Two 、 Update relevant methods
FixedUpdate()
Fixed update
Refresh the scene in frames , Refresh at fixed intervals
Physical related update operations , Put it in FixedUpdate() complete
Update()
to update
The execution time of each frame may be inconsistent with that of each frame
Update() The execution rate is related to hardware devices and rendered objects , Sometimes fast, sometimes slow
It mainly completes the update of data in the scene and the logical processing of data
LateUpdate()
Update later
When a frame execution ends , Before preparing for the next frame execution , This method is called
OnGUI()
Rendering and processing GUI event
3、 ... and 、 Destruction related methods
OnDisable()
When an object or script is unavailable ( Or inactive ) When the
Execute several times indefinitely
It's usually related to OnEnable() In combination with
OnDestory()
Only execute once in the whole life cycle
Be the object ( Script files ) Only execute this method when destroyed
Generally, it will be executed first OnDisable(), Make the object unavailable , And then destroy
边栏推荐
猜你喜欢

Thread sleep, thread sleep application scenarios

MySQL reads missing data from a table in a continuous period of time

20、 EEPROM memory (AT24C02) (similar to AD)

自动化测试的好处

10個 Istio 流量管理 最常用的例子,你知道幾個?

C form application of C (27)

MySql数据库root账户无法远程登陆解决办法

【可调延时网络】基于FPGA的可调延时网络系统verilog开发

【PSO】基于PSO粒子群优化的物料点货物运输成本最低值计算matlab仿真,包括运输费用、代理人转换费用、运输方式转化费用和时间惩罚费用

WPF效果第一百九十一篇之框选ListBox
随机推荐
[meisai] meisai thesis reference template
MySQL transaction isolation level
Mathematical modeling regression analysis relationship between variables
10 exemples les plus courants de gestion du trafic istio, que savez - vous?
Benefits of automated testing
《2022年中国银行业RPA供应商实力矩阵分析》研究报告正式启动
【FPGA教程案例12】基于vivado核的复数乘法器设计与实现
[optimization model] Monte Carlo method of optimization calculation
P3033 [usaco11nov]cow steelchase g (similar to minimum path coverage)
有条件地 [JsonIgnore]
KS008基于SSM的新闻发布系统
math_ Derivative function derivation of limit & differential & derivative & derivative / logarithmic function (derivative definition limit method) / derivative formula derivation of exponential functi
自动化测试的好处
MySQL reads missing data from a table in a continuous period of time
2/12 didn't learn anything
Esp32 (based on Arduino) connects the mqtt server of emqx to upload information and command control
Solution to the problem that the root account of MySQL database cannot be logged in remotely
STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储
Yyds dry goods inventory web components series (VII) -- life cycle of custom components
Blue Bridge Cup - Castle formula