Unity 6.3
0 онлайн 21 гостей 3 в системе
Вход

AudioSource.spread

Declaration

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; } } }