Behaviour.enabled 行为启用

var enabled : bool

Description描述

Enabled Behaviours are Updated, disabled Behaviours are not.

启用行为被更新,禁用行为不更新。

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

在行为检视面板显示为小的复选框。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		GetComponent<PlayerScript>().enabled = false;
	}
}
GetComponent(PlayerScript).enabled = false;
Page last updated: 2011-1-25