Version: 2017.2
public float spread ;

描述

设置扬声器空间中 3D 立体声或多声道声音的扩散角度(以度为单位)。

0 = 所有声道都位于同一个扬声器位置并且为“单声道”。360 = 所有子通道都位于与根据 3D 位置确定的扬声器位置相对的扬声器位置。默认为 0。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { 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; } }