Version: 2022.3
言語: 日本語
public float spread ;

説明

3D ステレオが広がる角度 (度単位)かスピーカー空間のマルチチャンネルを設定します。

0 はすべてのサウンドチャネルが同じスピーカーの位置にあり、'モノラル'です。360 はすべてのサブチャンネルが 3D の位置にあるべきスピーカーの位置と反対側のスピーカー位置に配置されます。デフォルトは 0 です。

using UnityEngine;

public class Example : MonoBehaviour { // when any AudioSource goes trough this transform, it will set it as 'mono' // and will restore the value to 3D effect after exiting // Make sure the audio source has a collider. void OnTriggerEnter(Collider other) { AudioSource audio = other.GetComponent<AudioSource>();

if (audio) { audio.spread = 0; } }

void OnTriggerExit(Collider other) { AudioSource audio = other.GetComponent<AudioSource>();

if (audio) { audio.spread = 360; } } }