言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

AudioSource

Namespace: UnityEngine

/

Inherits from: Behaviour

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Description

3D 空間でのオーディオの表現を行います。

An AudioSource is attached to a GameObject for playing back sounds in a 3D environment. サウンドを再生するた めには、必ずAudioListenerコンポーネントがシーンにある1 つのオブジェクトに付加さ れている必要があります。デフォルトではメインカメラに付いています。 You can play a single audio clip using Play, Pause and Stop. You can also adjust its volume while playing using the volume property, or seek using time. Multiple sounds can be played on one AudioSource using PlayOneShot. You can play a clip at a static position in 3D space using PlayClipAtPoint. See Also: AudioListener, AudioClip, AudioSource component.

Variables

bypassEffects Bypass effects (Applied from filter components or global listener filters).
clip The default AudioClip to play.
dopplerLevel Sets the Doppler scale for this AudioSource.
ignoreListenerPause Allows AudioSource to play even though AudioListener.pause is set to true. This is useful for the menu element sounds or background music in pause menus.
ignoreListenerVolume This makes the audio source not take into account the volume of the audio listener.
isPlaying クリップが再生中かどうか(読み取り専用)。
loop オーディオクリップがループしているかどうか。
maxDistance (Logarithmic rolloff) 減衰停止距離を設定する。
minDistance 減衰処理をしない最小距離を設定する。
mute ミュートにするかどうか。
pan チャンネルのパン位置を設定する。2D に対してのみ機能。
panLevel オーディオが2D か3D かを設定する。
pitch スローダウン・スピードアップのためのピッチ変化量(デフォルトは1)。
playOnAwake trueの場合、オーディオソースがゲーム再生時、自動的に再生する。
priority AudioSourceオブジェクトの優先順位を設定する。
rolloffMode 距離によって減衰する方法を設定/取得する。
spread 3D ステレオやスピーカー空間の、マルチチャンネルサウンドのアングルの
time 秒単位の再生時間。
timeSamples PCM のサンプル再生時間。
velocityUpdateMode fixedまたはdynamicで更新する必要があるかを返す(デフォルトはfixed)。
volume ボリュームの大きさ(0.0 to 1.0)。

Functions

GetOutputData 再生中のSourceの出力データのブロックを返します。
GetSpectrumData 再生中のSourceのスペクトルデータのブロックを返します。
Pause clip の再生を一時停止します。
Play 一定のディレイを持たせて clip を再生します。
PlayDelayed 秒単位で指定されたディレイで clip を再生します。ユーザーは44.1kHzの参照レートに関係しているサンプルの指定されたディレイを引数とした古いPlay(delay)関数の代わりにこの関数を使用することをオススメします。
PlayOneShot 一度だけ再生する。
PlayScheduled Plays the clip at a specific time on the absolute time-line that AudioSettings.dspTime reads from.
SetScheduledEndTime Changes the time at which a sound that has already been scheduled to play will end. Notice that depending on the timing not all rescheduling requests can be fulfilled.
SetScheduledStartTime Changes the time at which a sound that has already been scheduled to play will start.
Stop Stops playing the clip.

Static Functions

PlayClipAtPoint 指定されたワールド空間の位置でAudioClipを再生します。

Inherited members

Variables

enabled 有効であれば更新され、無効であれば更新されません。
isActiveAndEnabled Has the Behaviour had enabled called.
animation GameObjectにアタッチされたAnimation (アタッチされていない場合はnull)
audio GameObjectにアタッチされたAudioSource (アタッチされていない場合はnull)
camera GameObjectにアタッチされたCamera (アタッチされていない場合はnull)
collider GameObjectにアタッチされたCollider (アタッチされていない場合はnull)
collider2D GameObjectにアタッチされたCollider2D
constantForce GameObjectにアタッチされたConstantForce (アタッチされていない場合はnull)
gameObject このコンポーネントはゲームオブジェクトにアタッチされます。コンポーネントはいつもゲームオブジェクトにアタッチされています。
guiText GameObjectにアタッチされたGUIText (アタッチされていない場合はnull)
guiTexture GameObjectにアタッチされたGUITexture (アタッチされていない場合はnull)
hingeJoint GameObjectにアタッチされたHingeJoint (アタッチされていない場合はnull)
light GameObjectにアタッチされたLight (アタッチされていない場合はnull)
networkView GameObjectにアタッチされたNetworkView (アタッチされていない場合はnull)
particleEmitter GameObjectにアタッチされたParticleEmitter (アタッチされていない場合はnull)
particleSystem GameObjectにアタッチされたParticleSystem (アタッチされていない場合はnull)
renderer GameObjectにアタッチされたRenderer (アタッチされていない場合はnull)
rigidbody GameObjectにアタッチされたRigidbody (アタッチされていない場合はnull)
rigidbody2D GameObjectにアタッチされたRigidbody2D
tag ゲームオブジェクトのタグ
transform GameObjectにアタッチされたTransform (アタッチされていない場合はnull)
hideFlags オブジェクトは非表示、シーンに保存、ユーザーが編集可能などを行うかどうか
name オブジェクト名

Functions

BroadcastMessage ゲームオブジェクトまたは子オブジェクトにある すべての MonoBehaviour を継承したクラスにある methodName 名のメソッドを呼び出します。
CompareTag Is this game object tagged with /tag/?
GetComponent Returns the component of Type type if the game object has one attached, null if it doesn't.
GetComponentInChildren Returns the component of Type type in the GameObject or any of its children using depth first search.
GetComponentInParent Returns the component of Type type in the GameObject or any of its parents.
GetComponents Returns all components of Type type in the GameObject.
GetComponentsInChildren Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent Returns all components of Type type in the GameObject or any of its parents.
SendMessage Calls the method named methodName on every MonoBehaviour in this game object.
SendMessageUpwards Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
GetInstanceID Returns the instance id of the object.
ToString ゲームオブジェクトの名前を返します

Static Functions

Destroy ゲームオブジェクト、コンポーネントやアセットを削除します
DestroyImmediate 直ちにオブジェクトを破壊する。ですが、Destroy関数の方を使うことを推奨します
DontDestroyOnLoad 新しいシーンを読み込んでもオブジェクトが自動で破壊されないように設定します
FindObjectOfType タイプから最初に見つけたアクティブのオブジェクトを返します
FindObjectsOfType タイプから見つけた全てのアクティブのオブジェクト配列を返します
Instantiate original のオブジェクトをクローンします

Operators

bool オブジェクトが存在するかどうか
operator != 二つのオブジェクトが異なるオブジェクトを参照しているか比較します
operator == 二つのオブジェクトが同じオブジェクトを参照しているか比較します