Version: 2022.3
Removed

GameObject.audio

切换到手册
Obsolete public Component audio ;

描述

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

using UnityEngine;

public class Example : MonoBehaviour { void Start() { gameObject.GetComponent<AudioSource>().Play(); } }