paul
New Member
Posts: 2
Posts: 2
|
Post by paul on Nov 12, 2014 4:05:10 GMT
Getting the following! I've done the upgrading of the prefab, I've actually tried re-creating my entire MasterAudio prefab and re-importing all the groups and still get this.
ArgumentOutOfRangeException: Argument is out of range. Parameter name: index System.Collections.Generic.List`1[SoundGroupVariation].get_Item (Int32 index) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633) MasterAudio.SetBusVolume (.GroupBus bus, Single newVolume) (at Assets/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:3097) MasterAudio.SetBusVolumeByName (System.String busName, Single newVolume) (at Assets/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:3066) PlayerController+<PlayLevelUpSound>c__Iterator4C.MoveNext () (at Assets/Scripts/Entity/Player/PlayerController.cs:575) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) PlayerController:LevelUp() (at Assets/Scripts/Entity/Player/PlayerController.cs:567)
I am on v3.5.6.4. The problematic code appears to be:
MasterAudio.SetBusVolumeByName("Effects", volume); And there shouldn't be any problem with either of those two parameters. Any ideas?
Thanks! Paul
|
|
|
Post by DarkTonic Dev on Nov 12, 2014 4:44:45 GMT
That code was buggy. Fixed this method on line 3070 in MasterAudio.cs.
private static void SetBusVolume(GroupBus bus, float newVolume) { bus.volume = newVolume;
AudioInfo aInfo; AudioSource aSource = null; AudioGroupInfo aGroup = null; SoundGroupVariation aVar = null;
foreach (var key in audioSourcesBySoundType.Keys) { aGroup = audioSourcesBySoundType[key]; var groupBus = GetBusByIndex(aGroup._group.busIndex);
if (groupBus == null || groupBus.busName != bus.busName) { continue; }
for (var i = 0; i < aGroup._sources.Count; i++) { aInfo = aGroup._sources[i]; aSource = aInfo.source;
if (!aSource.isPlaying) { continue; }
var grpVol = aGroup._group.groupMasterVolume * bus.volume * MasterAudio.Instance.masterAudioVolume; var newVol = (aInfo.originalVolume * aInfo.lastPercentageVolume * grpVol) + aInfo.lastRandomVolume; aSource.volume = newVol; aVar = aSource.GetComponent<SoundGroupVariation>(); aVar.SetGroupVolume = grpVol; } } }
Really this line near the end is the only change.
aVar = aSource.GetComponent<SoundGroupVariation>();
|
|
paul
New Member
Posts: 2
Posts: 2
|
Post by paul on Nov 12, 2014 5:17:50 GMT
Perfect, all better. Thanks for the lightning response!
|
|
|
Post by DarkTonic Dev on Nov 12, 2014 5:19:29 GMT
No problem.
|
|