Version: 2017.2
Removed

GameObject.rigidbody

切换到手册
Obsolete public Component rigidbody ;

描述

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

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public GameObject other; public Rigidbody rb = other.GetComponent<Rigidbody>(); void Example() { rb.AddForce(1, 1, 1); } }