Collider.enabled 启用
var enabled : boolean
Description描述
Enabled Colliders will collide with other colliders, disabled Colliders won't.
启用碰撞器将会碰撞其他碰撞器,禁用碰撞器就不会碰撞其他碰撞器。
This is shown as the small checkbox in the inspector of the Colliders.
这个在碰撞器的检视面板显示为一个小的复选框。
C#
JavaScript
using UnityEngine;using System.Collections;public class example : MonoBehaviour {void Awake() {collider.enabled = false;}}
collider.enabled = false;