当前位置: 代码迷 >> 综合 >> Unity Behaviour.enabled作用
  详细解决方案

Unity Behaviour.enabled作用

热度:47   发布时间:2023-11-13 21:15:25.0

这个属性的官方文档描述为:

Enabled Behaviours are Updated, disabled Behaviours are not.

This is shown as the small checkbox in the inspector of the behaviour.

enabled为true是更新,为false时不更新。

就是说在enabled为false时会禁用本脚本中一切与Update(FixedUpdate等)相关的代码,所以如果在update里面设置为false则只能通过携程或者Invoke或者其他物体来设置为true。

  相关解决方案