当前位置:网站首页>Unity 之 ExecuteAlways正在取代ExecuteInEditMode
Unity 之 ExecuteAlways正在取代ExecuteInEditMode
2022-07-05 06:34:00 【陈言必行】
Unity 基础 之 ExecuteAlways介绍
在Unity的编辑器中分为三种模式:
- 编辑器模式:打开任意工程,不做任何操作Unity就处于一个可编辑的状态,这就是编辑器模式;
- 运行模式:当我们点击Play()运行一个场景时,这时Unity就处于运行模式;
- 预制体模式:当Unity进入Prefab时对应的编辑状态叫预制体模式;
ExecuteInEditMode
描述:使脚本的所有实例都在编辑模式下执行。
默认情况下,只在编辑器运行模式下执行 MonoBehaviours。通过添加此属性,MonoBehaviour 的任何实例都将在编辑器处于编辑模式时执行其回调函数。
此属性正在逐步被淘汰,因为它不考虑预制体模式。如果在预制件模式下编辑一个带有 MonoBehaviour 并启用了此属性的预制件,然后进入播放模式,则编辑器将退出预制件模式,以防止由仅用于播放模式的逻辑引起的预制件意外修改。
要指示 MonoBehaviour 正确考虑了预制件模式并且在播放模式期间以预制件模式打开是安全的,可以使用属性 ExecuteAlways 取代此属性。
下面几个函数和运行模式下调用情况不同:
- Update:只有当场景发生变化时才会调用。
- OnGUI:在“游戏视图”接收到非编辑器时调用。事件它不使用(例如,EventType.ScrollWheel)并且不转发到编辑器的键盘快捷方式系统(例如,EventType.KeyDown, EventType.KeyUp)。转发到游戏视图的事件将排队,不能保证立即处理。
- OnRenderObject:在场景视图或游戏视图的每一次重绘上都调用其他呈现回调函数。
ExecuteAlways
使脚本的实例始终执行,作为Play Mode的一部分和Editing。
默认情况下,MonoBehaviours仅在Play Mode下执行。
当希望脚本作为编辑器工作的一部分执行某些操作时,可以使用[ExecuteAlways]属性,该工具不一定与构建
仅在Scene发生改变是调用Update
当Game 试图接收到它不使用的非编辑器事件(例如,EventType.ScrollWheel)会调用OnGUI
在场景试图或者Game试图的每次重绘都会调用OnRenderObject和其他渲染回调函数
边栏推荐
- GDB code debugging
- Chinese remainder theorem acwing 204 Strange way of expressing integers
- 安装OpenCV--conda建立虚拟环境并在jupyter中添加此环境的kernel
- Technology blog learning website
- [MySQL 8.0 does not support capitalization of table names - corresponding scheme]
- Stack acwing 3302 Expression evaluation
- Package webapp or H5 pages into apps
- 如何正确在CSDN问答进行提问
- PR automatically moves forward after deleting clips
- Interval problem acwing 906 Interval grouping
猜你喜欢

namespace
![[Gaode map POI stepping pit] amap Placesearch cannot be used](/img/4c/55586ffcc2267c477a4532ab51a0c1.png)
[Gaode map POI stepping pit] amap Placesearch cannot be used

Pycahrm reports an error: indentation error: unindent does not match any outer indentation

Interval problem acwing 906 Interval grouping

5. Oracle tablespace
![[MySQL 8.0 does not support capitalization of table names - corresponding scheme]](/img/ea/a1e0722c43f56aff3e79f95c99ba8a.png)
[MySQL 8.0 does not support capitalization of table names - corresponding scheme]

Dameng database all

confidential! Netease employee data analysis internal training course, white whoring! (attach a data package worth 399 yuan)

7.Oracle-表结构

Orin two brushing methods
随机推荐
The “mode“ argument must be integer. Received an instance of Object
[MySQL 8.0 does not support capitalization of table names - corresponding scheme]
All English in the code
5. Oracle TABLESPACE
Volcano 资源预留特性
June 29, 2022 daily
Marvell 88e1515 PHY loopback mode test
5.Oracle-錶空間
Xavier CPU & GPU high load power consumption test
Relevant information of National Natural Science Foundation of China
Financial risk control practice -- feature derivation based on time series
LSA Type Explanation - lsa-5 (type 5 LSA - autonomous system external LSA) and lsa-4 (type 4 LSA - ASBR summary LSA) explanation
Some classic recursion problems
Volcano resource reservation feature
在本地搭建一个微服务集群环境,学习自动化部署
H5 embedded app adapts to dark mode
Page type
代码中的英语全部
Technical conference arrangement
PHY驱动调试之 --- PHY控制器驱动(二)