Version: 2021.3
Removed

GameObject.rigidbody

切换到手册
Obsolete public Component rigidbody ;

描述

附加到此 GameObject 的 Rigidbody(只读)。(如果未附加,则为 null)。

using UnityEngine;

public class Example : MonoBehaviour { void Start() { gameObject.GetComponent<Rigidbody>().AddForce(0, 0, 1); } }