Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

Populate throws an "ArgumentOutOfRangeException: Index was out of range"

0 votes

Hello,

We are using Wwise v2019.2.2 in Unity 2019.3.13f1 and we have an error when we try to Populate (i.e. from the Wwise Picker):

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <437ba245d8404784b9fbab9b439ac908>:0
  at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <437ba245d8404784b9fbab9b439ac908>:0
  at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <437ba245d8404784b9fbab9b439ac908>:0
  at System.Collections.Generic.List`1[T].System.Collections.IList.get_Item (System.Int32 index) [0x00000] in <437ba245d8404784b9fbab9b439ac908>:0
  at System.Collections.ArrayList+IListWrapper.get_Item (System.Int32 index) [0x00000] in <437ba245d8404784b9fbab9b439ac908>:0
  at AkWwiseWWUBuilder.GetWwuPathAndIcons (System.String in_parentRelativePhysicalPath, System.String in_wwuType, System.String in_relativePhysicalPath, System.Collections.Generic.LinkedList`1[AkWwiseProjectData+PathElement]& out_PathAndIcons) [0x00056] in Assets\Wwise\Editor\WwiseWindows\AkWwiseWWUBuilder.cs:914
  at AkWwiseWWUBuilder.CreateWorkUnit (System.String in_relativePath, System.String in_wwuType, System.String in_fullPath) [0x0015e] in Assets\Wwise\Editor\WwiseWindows\AkWwiseWWUBuilder.cs:838
  at AkWwiseWWUBuilder.UpdateFiles () [0x0007e] in Assets\Wwise\Editor\WwiseWindows\AkWwiseWWUBuilder.cs:480
  at AkWwiseWWUBuilder.Populate () [0x0009e] in Assets\Wwise\Editor\WwiseWindows\AkWwiseWWUBuilder.cs:101
UnityEngine.Debug:LogError(Object)
AkWwiseWWUBuilder:Populate() (at Assets/Wwise/Editor/WwiseWindows/AkWwiseWWUBuilder.cs:106)
AkWwiseProjectInfo:Populate() (at Assets/Wwise/Editor/WwiseWindows/AkWwiseProjectInfo.cs:77)
AkWwisePicker:OnGUI() (at Assets/Wwise/Editor/WwiseWindows/AkWwisePicker.cs:39)

Any idea on how to fix this? The error is not very informative.

asked Jun 9 in General Discussion by Adrien V. (100 points)

1 Answer

+1 vote
answered Jun 15 by Mads Maretty S. (Audiokinetic) (4,820 points)
Hi, indeed it fixed it thanks. Any idea why it happens? Maybe when we upgraded to newer version of Wwise?
Hi again, if we modify an event in Wwise and regenerate the Windows bank we get this error again.
Hey again. Seems I cannot replicate this. Is your Wwise project saved and your Wwise paths assigned in Unity's Project Settings > Wwise Editor?
The AkWwiseProjectData.asset is a cache file storing data from the Wwise project, so that the Wwise Picker doesn't have to parse the info directly from the Work Units. So if the above doesn't work, maybe you could try selecting the AkWwiseProjectData.asset file in Unity, and in the Inspector, see if you can spot your new event / event changes and whether the ID is ok.
The Wwise project and installation paths are well assigned.
The AkWwiseProjectData.asset in the inspector doesn't contain the new events (it seems it has not been updated by the process).
Here are the repro steps:
In Wwise, in Events, in "Events/Default Work Unit" add a Work unit with at least 1 event. Save.
In Unity use Refresh Project in Wwise Picker.
In Wwise rename the event in the inner work unit. Save.
In Unity use Refresh Project and see the exception and the event is not renamed.
I've been having exactly the same problem since upgrading. I need to delete "AkWwiseProjectData" any time I want to update anything used by Wwise Picker.
Hi Mads - is this because of:

#if UNITY_2019_3_OR_LATER
                        if (UnityEditor.EditorSettings.assetPipelineMode == UnityEditor.AssetPipelineMode.Version2)
                        {
                            UnityEditor.EditorApplication.delayCall += () => UnityEditor.AssetDatabase.CreateAsset(m_Data, DataAssetPath);
                        }
                        else
#else
                        {
                            UnityEditor.AssetDatabase.CreateAsset(m_Data, DataAssetPath);
                        }
#endif

inside AkWwiseProjectInfo.GetData() where the delaycall is being subscribed to? Looks like it's getting called on line 827 in the AkWwiseWWUBuilder class? I'm not entirely sure, just a hunch. Wish I had some time to hunt around!

Some other notes:

I did some digging and it seems the BinarySearch in AkWwiseWWUBuilder.GetWwuPathAndIcons (line 913) seems to be returning -1 on "Default Work Unit" for our project.
The two objects in the array had "Default Work Unit\\WwuName". Maybe it's due to the 2019.3 delayCall subscription and the list not being populated at the right time?

line 914 has the line:
wwuRelPath = (list[index] as AkWwiseProjectData.WorkUnit).ParentPath;

that causes the exception.
Hey Everyone. Thanks for reporting this and all of your responses.
We've fixed the issue, so look out for WG-49902 in future Wwise release notes under "Community Reported Bug Fixes".
...