当前位置:网站首页>Executealways of unity is replacing executeineditmode
Executealways of unity is replacing executeineditmode
2022-07-05 06:51:00 【Chen Yan will act】
Unity Basics And ExecuteAlways Introduce
stay Unity The editor of is divided into three modes :
- Editor Mode : Open any project , Do nothing Unity It is in an editable state , This is the editor mode ;
- Operation mode : When we click Play() When running a scenario , At this time Unity It is in operation mode ;
- Preform mode : When Unity Get into Prefab The corresponding editing state is called preform mode ;
ExecuteInEditMode
describe : Make all instances of the script execute in edit mode .
By default , Only execute in editor running mode MonoBehaviours. By adding this attribute ,MonoBehaviour Any instance of will execute its callback function when the editor is in edit mode .
This attribute is being phased out , Because it does not consider the precast mode . If you edit a with MonoBehaviour And the preform with this attribute enabled , Then enter the playback mode , The editor will exit the preform mode , To prevent accidental modification of the preform caused by the logic used only in the playback mode .
To instruct MonoBehaviour It is safe to consider the preform mode correctly and open it in the preform mode during the playback mode , You can use properties ExecuteAlways Replace this attribute .
The following functions and operation modes are called differently :
- Update: Only when the scene changes .
- OnGUI: stay “ Game view ” Called when a non editor is received . Event it does not use ( for example ,EventType.ScrollWheel) And do not forward to the editor's keyboard shortcut system ( for example ,EventType.KeyDown, EventType.KeyUp). Events forwarded to the game view will be queued , Immediate treatment cannot be guaranteed .
- OnRenderObject: Call other rendering callback functions on each redrawing of the scene view or game view .
ExecuteAlways
Make the instance of the script always execute , As Play Mode Part of and Editing.
By default ,MonoBehaviours Only in Play Mode perform .
When you want the script to do something as part of the editor's work , have access to [ExecuteAlways] attribute , This tool is not necessarily related to building
Only in Scene The change is called Update
When Game Trying to receive a non editor event that it does not use ( for example ,EventType.ScrollWheel) Would call OnGUI
Try or Game Every attempt to redraw will call OnRenderObject And other rendering callback functions
边栏推荐
- LSA Type Explanation - detailed explanation of lsa-2 (type II LSA network LSA) and lsa-3 (type III LSA network Summary LSA)
- ‘mongoexport‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。
- GDB code debugging
- Preemption of CFS scheduling
- Sre core system understanding
- Configuration method and configuration file of SolidWorks GB profile library
- The “mode“ argument must be integer. Received an instance of Object
- Initialization of global and static variables
- new和malloc的区别
- Ros2 - workspace (V)
猜你喜欢

在本地搭建一个微服务集群环境,学习自动化部署

【软件测试】06 -- 软件测试的基本流程

The “mode“ argument must be integer. Received an instance of Object

数据库Mysql全部

PHY驱动调试之 --- MDIO/MDC接口22号和45号条款(一)

Instruction execution time

Rehabilitation type force deduction brush question notes D1

Positive height system

namespace

扫盲-以太网MII接口类型大全-MII、RMII、SMII、GMII、RGMII、SGMII、XGMII、XAUI、RXAUI
随机推荐
PHY驱动调试之 --- PHY控制器驱动(二)
Ret2xx---- common CTF template proposition in PWN
vim
Vant weapp swippecell set multiple buttons
Volcano resource reservation feature
Integer to 8-bit binary explanation (including positive and negative numbers) scope of application -127~+127
在本地搭建一个微服务集群环境,学习自动化部署
Orin 安装CUDA环境
三体目标管理笔记
Error: “MountVolume.SetUp failed for volume pvc 故障处理
ROS2——配置开发环境(五)
ROS2——功能包(六)
Rehabilitation type force deduction brush question notes D3
Pycahrm reports an error: indentation error: unindent does not match any outer indentation
2022年中纪实 -- 一个普通人的经历
Package webapp or H5 pages into apps
Use the Paping tool to detect TCP port connectivity
postmessage通信
PR automatically moves forward after deleting clips
Getting started with typescript