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

+1 vote

My team has been running into a problem when multiple people are using Wwise in a Unity project.

Wwise in Unity uses WwiseEventReference assets (based on ScriptableObject) to serialize what events are used by a component. However, these assets are generated from the native Wwise project data lazily - i.e. the asset for an event doesn't exist until the first time someone drags that event onto a component.

The problem is that when multiple people use Wwise in the project, both might drag the same event for the "first time", thus generating two unique WwiseEventReference assets for the same event. When the two try to merge in source control, the assets conflict and one person's event uses must be re-done with whichever asset is chosen to overwrite the other in conflict resolution.

  • User 1 makes changes to the Wwise project
  • User 1 opens Unity and the Wwise Picker updates - this updates AkWwiseProjectData.asset
  • User 1 commits to source control
  • User 1 then drags a new Wwise event - Event A - from the Wwise Picker onto a component
    • This creates an AkWwiseEventReference asset for Event A - Asset A - in User 1's local copy of the Unity project
  • User 2 pulls the latest commit from source control
  • User 2 drags Event A onto a component
    • Since User 1's AkWwiseEventReference Asset A is not in source control yet, this creates a new Asset A in User 2's local copy of the Unity project
  • User 1 commits to source control
  • User 2 tries to pull the latest commit from source control
    • A conflict occurs as source control tries to pull User 1's version of Asset A but User 2 already has one
    • User 2 chooses to overwrite their version with User 1's version
  • User 2 no longer has a reference to Event A in the component(s) they dragged it onto
    • Unity generates a random GUID for every asset created, which will not be the same for User 1 and User 2's versions of Asset A
    • Unity uses the GUID to track references, so the GUID stored from User 2's original use of Event A is now invalid and the reference has been lost

In my opinion the ideal solution would be to ditch lazy asset generation, and eagerly generate the Unity assets for new events as soon as the Wwise project is updated.

In the meantime I've written an import post-processor to force this behaviour:

using UnityEditor;
public class WwiseProjectImporter : AssetPostprocessor {
    const string PROJECTDATA_PATH = "Assets/Wwise/Editor/ProjectData/AkWwiseProjectData.asset";
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths){
        var data = AssetDatabase.LoadAssetAtPath<AkWwiseProjectData>(PROJECTDATA_PATH);
        foreach (var wu in data.EventWwu){
            foreach (var e in wu.List){
                WwiseObjectReference.FindOrCreateWwiseObject(WwiseObjectType.Event, e.Name, e.Guid);
            }
        }
    }
}
 
in Feature Requests by Luke T. (110 points)
Having the same issue - can this please be addressed?

Please sign-in or register to answer this question.

...