Play Soundで音が鳴りません

Here is the forum to do the questions about how to use to Arbor developer.
Attention point:
  • We can not answer your questions about your project specific issues.
  • We can not answer your questions on Unity's specification issues.
  • Please check Arbor Documentation and ask a question if you still don't know how to use it. If the desired function is not described in the document, it is highly possible that the function does not exist from the beginning, so go to the request forum.

ここは、Arbor開発者へ使い方に関する質問を行うフォーラムです。
注意点:
  • ユーザー様のプロジェクトの仕様上の問題や設計に対する質問には答えられません。
  • Unityの仕様上の問題に対する質問には答えられません。
  • Arbor Documentationを確認の上、それでも使い方がわからない場合にご質問ください。欲しい機能の記載がドキュメントにない場合は機能が元から存在しない可能性が高いので要望フォーラムへ。

Forum rules
Here is the forum to do the questions about how to use to Arbor developer.
Attention point:
  • We can not answer your questions about your project specific issues.
  • We can not answer your questions on Unity's specification issues.
  • Please check Arbor Documentation and ask a question if you still don't know how to use it. If the desired function is not described in the document, it is highly possible that the function does not exist from the beginning, so go to the request forum.

ここは、Arbor開発者へ使い方に関する質問を行うフォーラムです。
注意点:
  • ユーザー様のプロジェクトの仕様上の問題や設計に対する質問には答えられません。
  • Unityの仕様上の問題に対する質問には答えられません。
  • Arbor Documentationを確認の上、それでも使い方がわからない場合にご質問ください。欲しい機能の記載がドキュメントにない場合は機能が元から存在しない可能性が高いので要望フォーラムへ。
tichise
Posts: 3
Joined: 2023/06/15 13:09

Play Soundで音が鳴りません

Post by tichise »

初歩的な質問で申し訳ありませんが、Play Soundで音が鳴りません。解決方法を教えてください。
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: Play Soundで音が鳴りません

Post by caitsithware »

PlaySoundについてのご質問ですね。

PlaySoundを使用して音を鳴らす手順は以下の通りです。
  1. 音を聞きたいGameObjectにAudioListenerコンポーネントがあるか確認
    デフォルトではMain Cameraに最初からついていますが、シーンに一つもない場合は追加が必要です。
  2. 音を鳴らしたいGameObjectにAudioSourceコンポーネントを追加。
  3. AudioSourceのAudioClipフィールドに鳴らしたいAudioClipを設定。
    ※あとからPlaySound側で鳴らしたいAudioClipを設定することもできます。
  4. AudioSourceのPlayOnAwakeのチェックを外す。
    チェックを外すことでプレイ開始時に音がなってしまうのを防ぎます。
  5. ArborFSMもしくはBehaviourTreeに移り、鳴らしたいタイミングでPlaySoundを使用する。
  6. PlaySoundのAudio Sourceフィールドに先ほど追加したAudioSourceコンポーネントを指定。
    グラフのあるGameObjectにAudioSourceコンポーネントもある場合は「Self」のままでもOKです。
  7. PlaySound側で鳴らしたいAudioClipを上書きする場合は、Is Set Clipフィールドにチェックをつけ、Clipフィールドに鳴らしたいAudioClipを設定。
以上になります。
またAudioSourceの設定やAudioListenerとの位置関係、ゲームビューの「Mute Audio」などにより、再生処理を呼び出していても聞こえない場合があります。
設定が正しいかの確認も行ってみてください。

関連ドキュメント
tichise
Posts: 3
Joined: 2023/06/15 13:09

Re: Play Soundで音が鳴りません

Post by tichise »

ありがとうございます。早速試してみます。
tichise
Posts: 3
Joined: 2023/06/15 13:09

Re: Play Soundで音が鳴りません

Post by tichise »

鳴らすことができました。ありがとうございます。
Post Reply