Unity说明文档翻译-Script Execution Order Settings

Unity中的脚本执行顺序默认按加载顺序执行,但可通过Script Execution Order设置进行调整。在编辑>项目设置>脚本执行顺序中,可以添加脚本并拖动改变其执行相对顺序,位于Default Time上方的脚本先执行,下方的后执行。脚本对话框中的顺序决定了执行顺序,未在对话框中的脚本按任意顺序在默认时间执行。
摘要由CSDN通过智能技术生成

Script Execution Order Settings

脚本执行顺序设置

By default, the Awake, OnEnable and Update functions of different scripts are called in the order the scripts are loaded (which is arbitrary). However, it is possible to modify this order using the Script Execution Order settings (menu: Edit > Project Settings > Script Execution Order).

默认的,不同脚本的Awake, OnEnable  Update函数按脚本加载顺序(这是任意的)调用.然而,可以使用脚本执行循序来设置(菜单:编辑>项目设置>脚本执行顺序).

Scripts can be added to the inspector using the Plus “+” button and dragged to change their relative order. Note that it is possible to drag a script either above or below the Default Time bar; those above will execute ahead of the default time while those below will execute after. The ordering of scripts in the dialog from top to bottom determines their execution order. All scripts not in the dialog execute in the default time slot in arbitrary order.

脚本可以通过加号+键添加到检视面板并拖动以改变它们的相对顺序.注意:可以拖动一个脚本到默认时间条上面或下面;上面将在默认时间之前执行而下面将在默认时间之后执行.脚本在对话框中的顺序决定它们执行的顺序.所有不再此对话框内的脚本在默认时间内按任意顺序执行.

The numbers shown for each script are the values the scripts are actually ordered by. When a script is dragged to a new position, the number for the script is automatically changed accordingly. When a number is changed, either manually or automatically, it changes the meta file for that script. For this reason it’s best if as few of the numbers as possible change when the order is changed. This is why, when possible, only the script that is dragged has its number changed, rather than assigning new numbers to all the scripts.

显示在每个脚本上的数值是脚本当前的排序值.当脚本被拖动到一个新位置时脚本的数值也会相应的改变.当一个数值改变了,无论手动还是自动,它都改变了这个脚本的meta文件.由于这个原因当排序改变时这些数值越少改变越好.这是因为,在可能的情况下,拖动脚本只是改变数值,而不是指派一个新的数值给所有脚本.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值