ºÇ½ª¹¹¿·¡§ orika_ex_miyako 2023ǯ09·î15Æü(¶â) 14:49:27ÍúÎò
¡¡AudioMixer.SetFloat ¥á¥½¥Ã¥É¤Ï¡¢»ØÄꤷ¤¿ AudioGroup ¤Î¥Ü¥ê¥å¡¼¥à¤òÀßÄꤹ¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¹¡£
Âè2°ú¿ô¤Ë»ØÄꤷ¤¿Ãͤ¬¡¢¤½¤Î¤Þ¤Þ¥Ü¥ê¥å¡¼¥àÃͤȤ·¤ÆÀßÄꤵ¤ì¤Þ¤¹¡£Êä´Ö½èÍý¤ÏŬÍѤµ¤ì¤Þ¤»¤ó¡£
audioMixerGroups[0].audioMixer.SetFloat(mixerGroupName, decibel);
¡¡Êä´Ö½èÍý¤ò¹Ô¤¤¤¿¤¤¾ì¹ç¤Ï¡¢DOTween ¤Ê¤É¤Î¥é¥¤¥Ö¥é¥ê¤ò»ÈÍѤ¹¤ë¤³¤È¤Ç¼Â¸½¤Ç¤¤Þ¤¹¡£
¡¡°Ê²¼¤Ï¡¢DOTween ¤ò»ÈÍѤ·¤¿¥µ¥ó¥×¥ë¥³¡¼¥É¤Ç¤¹¡£
¡¡
using DG.Tweening; using UnityEngine; using UnityEngine.Audio; public class AudioMixerController : MonoBehaviour { [SerializeField] private AudioMixer audioMixer; [SerializeField] private string mixerGroupName; [SerializeField] private float duration; public void SetLinearVolumeToMixerGroup(string mixerGroupName, float linerVolume) { float decibel = 20.0f * Mathf.Log10(linerVolume); if (float.IsNegativeInfinity(decibel)) { decibel = -96f; // ̵²»¤Ï -80f ¤Ç¤Ï¤Ê¤¯¤Æ -96f ¤Ë¤¹¤ë } ¡¡¡¡¡¡¡¡// DOTween ¤òÍøÍѤ·¤ÆÊä´Ö½èÍý¤ò¹Ô¤¦ audioMixerGroups[0].DOSetFloat(mixerGroupName, decibel, duration); } }
»²¹Í¥µ¥¤¥È
Github ¥Ï¥È¥Í¥³¥¨ ÍÍ
¥ª¡¼¥Ç¥£¥ª¤Î¥Õ¥§¡¼¥É¥¤¥ó¡¦¥Õ¥§¡¼¥É¥¢¥¦¥È¡§DOTween »ÈÍÑ¡Ê¥Ö¥í¥°¸ø³«ÍÑ¡Ë
https://gist.github.com/nekonenene/3643fe8e958fc8b...
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯