Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Removed
Property audio has been deprecated. Use GetComponent<AudioSource>() instead. (UnityUpgradable)

GameObject.audio

マニュアルに切り替える
public Component audio;

説明

ゲームオブジェクトにアタッチされている AudioSource (読み取り専用) (もしアタッチされていない場合は null)

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public GameObject other; void Example() { other.GetComponent<AudioSource>().Play(); } }