public static WwiseObjectReference GetWwiseObjectForMigration(WwiseObjectType wwiseObjectType, byte[] valueGuid) { System.Guid guid; try { guid = new System.Guid(valueGuid); } catch { UnityEngine.Debug.LogWarning("WwiseUnity: Invalid guid for WwiseObjectReference of type <WwiseObjectType." + wwiseObjectType + ">."); return(null); } System.Collections.Generic.Dictionary <System.Guid, WwiseObjectData> map = null; if (!WwiseObjectDataMap.TryGetValue(wwiseObjectType, out map)) { UnityEngine.Debug.LogWarning("WwiseUnity: Cannot find WwiseObjectReferences of type <WwiseObjectType." + wwiseObjectType + ">."); return(null); } WwiseObjectData data = null; if (!map.TryGetValue(guid, out data)) { UnityEngine.Debug.LogWarning("WwiseUnity: Cannot find guid <" + guid.ToString() + "> for WwiseObjectReference of type <WwiseObjectType." + wwiseObjectType + ">."); return(null); } return(FindOrCreateWwiseObject(wwiseObjectType, data.objectName, guid)); }
public static WwiseObjectReference GetWwiseObjectForMigration(WwiseObjectType wwiseObjectType, byte[] valueGuid, int id) { if (valueGuid == null) { return(null); } System.Collections.Generic.Dictionary <System.Guid, WwiseObjectData> map = null; if (!WwiseObjectDataMap.TryGetValue(wwiseObjectType, out map) || map == null) { UnityEngine.Debug.LogWarning("WwiseUnity: Cannot find WwiseObjectReferences of type <WwiseObjectType." + wwiseObjectType + ">."); return(null); } var guid = System.Guid.Empty; WwiseObjectData data = null; try { guid = new System.Guid(valueGuid); } catch { UnityEngine.Debug.LogWarning("WwiseUnity: Invalid guid for WwiseObjectReference of type <WwiseObjectType." + wwiseObjectType + ">."); return(null); } var formattedId = (uint)id; if (guid != System.Guid.Empty && !map.TryGetValue(guid, out data)) { UnityEngine.Debug.LogWarning("WwiseUnity: Cannot find guid <" + guid.ToString() + "> for WwiseObjectReference of type <WwiseObjectType." + wwiseObjectType + "> in Wwise Project."); foreach (var pair in map) { if (AkUtilities.ShortIDGenerator.Compute(pair.Value.objectName) == formattedId) { guid = pair.Key; data = pair.Value; UnityEngine.Debug.LogWarning("WwiseUnity: Found guid <" + guid.ToString() + "> for <" + pair.Value.objectName + ">."); break; } } } if (data == null) { return(null); } var objectReference = FindOrCreateWwiseObject(wwiseObjectType, data.objectName, guid); if (objectReference && objectReference.Id != formattedId) { UnityEngine.Debug.LogWarning("WwiseUnity: ID mismatch for WwiseObjectReference of type <WwiseObjectType." + wwiseObjectType + ">. Expected <" + formattedId + ">. Found <" + objectReference.Id + ">."); } return(objectReference); }
public static void UpdateWwiseObjectDataMap(WwiseObjectType wwiseObjectType, string name, System.Guid guid) { System.Collections.Generic.Dictionary <System.Guid, WwiseObjectData> map = null; if (!WwiseObjectDataMap.TryGetValue(wwiseObjectType, out map)) { map = new System.Collections.Generic.Dictionary <System.Guid, WwiseObjectData>(); WwiseObjectDataMap.Add(wwiseObjectType, map); } WwiseObjectData data = null; if (!map.TryGetValue(guid, out data)) { data = new WwiseObjectData(); map.Add(guid, data); } data.objectName = name; }