public bool enabled ;

描述

是否启用了此布料?

这与 Inspector 中的组件标签旁的复选框相同。 禁用的 Cloth 组件不会更新其物理模拟,因此在不需要布料对象时, 可以用它来暂停布料对象的模拟,因为布料模拟是一项 CPU 使用强度极高的任务。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { GetComponent<Cloth>().enabled = false; } }