《1》 //通过下面方法可以使smoothFollowSpeed的取值范围在{10,110}之间
[SerializeField] //* SerializeField序列化字段。
[Range(10, 110)] //* Range:该字段值的范围。
[SerializeField] //* SerializeField序列化字段。
[Range(10, 110)] //* Range:该字段值的范围。
float smoothFollowSpeed; //跟随的速度
《2》 RequireComponent:约束组件
[RequireComponent(typeof(Rigidbody))]
当附加该组件的时候。会强制自动添加组件typeof(Rigidbody)
RequireComponent约束的组件。是不能删除的。除非先删除当前脚本
[RequireComponent(typeof(Rigidbody), typeof(BoxCollider))]
《3》DisallowMultipleComponent:不能在一个对象上重复添加该脚本。
[DisallowMultipleComponent]
public class prot : MonoBehaviour
{