Version: 2021.2
言語: 日本語
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; } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961