直接使用GetComponent()以提高性能 根据官方文档所述,可以将 rigidbody2D = GetComponent<Rigidbody2D>(); 换成 rigidbody2D = GetComponent("Rigidbody2D"); 以提高性能。