[system.seralizable] //实例化
public class FlyEdge
{
public float minX;
public float maxX;
public float minY;
pubic float maxY;
}
pubic class playerControl :monoBehavipur
{
public FlyEdge border;
}
void FixedUpdata()
{
this.rigidbody.position=new vector3(mathf clamp(this.transform.position.X,border.minX,border.maxX),mathf clamp(this.transform.position.y,border.minY,border.maxY),0 )
}