Search Unity

Audio Wwise Integration, build failed at Unity Cloud ONLY

Discussion in 'Audio & Video' started by NexusMedia, Sep 29, 2018.

  1. NexusMedia

    NexusMedia

    Joined:
    Mar 1, 2018
    Posts:
    5
    we recently moved our project to unity cloud.
    project build ok at my dev computer and old build server (jenkins). unity cloud is always giving me Wwise build errors.
    anyone else have experienced this issue before? we did not modify any of these wwise scripts it was imported from wwise directly.

    2455: [Unity] Assets/Wwise/Deployment/API/Handwritten/Windows/AkWindowsSettings.cs(48,26): error CS0246: The type or namespace name `AkAudioAPI' could not be found. Are you missing an assembly reference?
    2456: [Unity] Assets/Wwise/Deployment/API/Handwritten/Windows/AkWindowsSettings.cs(48,13): error CS1061: Type `AkPlatformInitSettings' does not contain a definition for `eAudioAPI' and no extension method `eAudioAPI' of type `AkPlatformInitSettings' could be found. Are you missing an assembly reference?
    2457: [Unity] Assets/Wwise/Deployment/API/Generated/Mac/AkPlatformInitSettings_Mac.cs(13,14): (Location of the symbol related to previous error)
    2458: [Unity] Assets/Wwise/Deployment/API/Handwritten/Windows/AkWindowsSettings.cs(49,13): error CS1061: Type `AkPlatformInitSettings' does not contain a definition for `bGlobalFocus' and no extension method `bGlobalFocus' of type `AkPlatformInitSettings' could be found. Are you missing an assembly reference?
    2459: [Unity] Assets/Wwise/Deployment/API/Generated/Mac/AkPlatformInitSettings_Mac.cs(13,14): (Location of the symbol related to previous error)
     
  2. antifuzz

    antifuzz

    Joined:
    Feb 22, 2013
    Posts:
    99
    Did you ever find a solution for this? We're getting exactly the same thing.
     
  3. cshankland_unity

    cshankland_unity

    Joined:
    Mar 10, 2018
    Posts:
    5
    We also had this problem. It's because cloud builds (wrongly, imo, see: https://forum.unity.com/threads/windows-desktop-64-bit-being-built-on-a-mac-editor.633481/) have UNITY_EDITOR_OSX and UNITY_EDITOR defined.

    What you can do is change all instances of:
    #if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || UNITY_EDITOR_OSX

    to
    #if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || (UNITY_EDITOR_OSX && !UNITY_STANDALONE_WIN)


    And all instances of
    #if (UNITY_STANDALONE_WIN && !UNITY_EDITOR) || UNITY_EDITOR_WIN

    to
    #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN || UNITY_WSA


    Note that this is all in mostly generated wwise code, so if you update you may have to do it again.
     
    stalhandske and SampaioDias like this.
  4. SampaioDias

    SampaioDias

    Joined:
    Jul 22, 2017
    Posts:
    2
    Thank you sooooo much! It worked!
     
  5. SampaioDias

    SampaioDias

    Joined:
    Jul 22, 2017
    Posts:
    2
    Windows and Mac are working fine with Wwise, but Linux isn't. Any ideas?

    Here's the log:

    Preloaded 'ScreenSelector.so'
    Preloaded 'libAkHarmonizer.so'
    Preloaded 'libAkPitchShifter.so'
    Preloaded 'libAkSoundEngine.so'
    Preloaded 'libAkTimeStretch.so'
    Unable to preload the following plugins:
    ScreenSelector.so
    libAkHarmonizer.so
    libAkPitchShifter.so
    libAkSoundEngine.so
    libAkTimeStretch.so
    Logging to /home/invscp/.config/unity3d/SampaioDias/GameName/Player.log
    AK Error: Plug-in not found: 8912899
    AK Error: Plug-in not found: 8912899
    AK Error: Plug-in not found: 8912899
    AK Error: Plug-in not found: 8912899
    AK Error: Plug-in not found: 8912899
    AK Error: Plug-in not found: 8912899
    AK Error: Plug-in not found: 8519683
     
    Last edited: Mar 10, 2019
  6. Bodkin

    Bodkin

    Joined:
    Jul 12, 2012
    Posts:
    11
    Hey everyone,
    My team at BlackBox Realities ran into this problem a few months ago. In order to get around this issue, I created an editor script that went through the wwise folder and replaced the platform dependent compilation lines on the wwise script.

    I have pasted the code below:
    [Make sure to put the script inside of an Editor folder]

    Code (CSharp):
    1.  
    2. /* Copyright (C) 2019 Adrian Babilinski
    3. * You may use, distribute and modify this code under the
    4. * terms of the MIT License
    5. *
    6. *Permission is hereby granted, free of charge, to any person obtaining a copy
    7. *of this software and associated documentation files (the "Software"), to deal
    8. *in the Software without restriction, including without limitation the rights
    9. *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    10. *copies of the Software, and to permit persons to whom the Software is
    11. *furnished to do so, subject to the following conditions:
    12. *
    13. *The above copyright notice and this permission notice shall be included in all
    14. *copies or substantial portions of the Software.
    15. *
    16. *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    17. *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    18. *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    19. *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    20. *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    21. *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    22. *SOFTWARE.
    23. *
    24. *For more information contact adrian@blackboxrealities.com or visit blackboxrealities.com
    25. */
    26.  
    27. namespace BlackBoxRealities.Tools
    28. {
    29.     using System;
    30.     using UnityEngine;
    31.     using UnityEditor;
    32.     using System.IO;
    33.     /// <summary>
    34.     /// A fix for Cloud Build while using Wwise. Add to Editor Folder
    35.     /// </summary>
    36.     public class WwiseFixEditor : MonoBehaviour
    37.     {
    38.         [MenuItem("BlackBox Realities/Tools/Fix Wwise Cloud Build")]
    39.         public static void CreateNewGameObject()
    40.         {
    41.        
    42.             string path = EditorUtility.OpenFolderPanel("Wwise Root Folder in Assets", "", "");
    43.             GetDirectories(path);
    44.             AssetDatabase.Refresh();
    45.         }
    46.  
    47.         private static void GetDirectories(string path)
    48.         {
    49.             string[] directories = Directory.GetDirectories(path);
    50.             ReplaceFiles(Directory.GetFiles(path), path);
    51.  
    52.             foreach (string directory in directories)
    53.             {
    54.                 GetDirectories(directory);
    55.             }
    56.         }
    57.         private static void ReplaceFiles(string[] files, string path)
    58.         {
    59.  
    60.             foreach (string file in files)
    61.             {
    62.                 if (file.EndsWith(".cs"))
    63.                 {
    64.  
    65.                     var text = File.ReadAllText(file);
    66.  
    67.  
    68.                     var split = text.Split(Environment.NewLine.ToCharArray());
    69.  
    70.                     for (int i = 0; i < split.Length; i++)
    71.                     {
    72.                         //MAC
    73.                         if (split[i].Contains("#if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || UNITY_EDITOR_OSX"))
    74.                         {
    75.                             var old = split[i];
    76.                             split[i] = old.Replace("#if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || UNITY_EDITOR_OSX",
    77.                                                     "#if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || (UNITY_EDITOR_OSX && !UNITY_STANDALONE_WIN)");
    78.                             continue;
    79.                         }
    80.                         if (split[i].Equals("#if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || UNITY_EDITOR_OSX", StringComparison.OrdinalIgnoreCase))
    81.                         {
    82.  
    83.                             split[i] = "#if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || (UNITY_EDITOR_OSX && !UNITY_STANDALONE_WIN)";
    84.                             continue;
    85.                         }
    86.  
    87.  
    88.                         //WIN
    89.                         if (split[i].Contains("#if (UNITY_STANDALONE_WIN && !UNITY_EDITOR) || UNITY_EDITOR_WIN"))
    90.                         {
    91.                             var old = split[i];
    92.                             split[i] = old.Replace("#if (UNITY_STANDALONE_WIN && !UNITY_EDITOR) || UNITY_EDITOR_WIN",
    93.                                                    "#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN || UNITY_WSA");
    94.                             continue;
    95.                         }
    96.                         if (split[i].Equals("#if (UNITY_STANDALONE_WIN && !UNITY_EDITOR) || UNITY_EDITOR_WIN",
    97.                                             StringComparison.OrdinalIgnoreCase))
    98.                         {
    99.  
    100.                             split[i] =
    101.                                 "#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN || UNITY_WSA";
    102.                             continue;
    103.                         }
    104.                     }
    105.                     File.WriteAllLines(file, split);
    106.  
    107.  
    108.  
    109.  
    110.              
    111.  
    112.                 }
    113.             }
    114.         }
    115.  
    116.  
    117.  
    118.  
    119.  
    120.         public static void SetReleaseSetting()
    121.         {
    122.  
    123.             AkPluginActivator.ActivateRelease();
    124.  
    125.         }
    126.  
    127.  
    128.     }
    129. }
     
  7. talofa-parker

    talofa-parker

    Joined:
    May 26, 2021
    Posts:
    3
    Hi all,
    My team and I have still been encountering this issue even after changing the preprocessor directives and using the script that automates replacement.

    However even after following the steps listed here, our cloud builds cannot complete due to Wwise compiler errors -- ex:
    Code (CSharp):
    1. Assets/Wwise/API/Runtime/Handwritten/Common/AkCommonPlatformSettings.cs(299,39): error CS0117: 'AkSoundEngine' does not contain a definition for 'AK_MAX_SOUND_PROPAGATION_DEPTH'
    This is likely due to the CI VM being a Linux machine, however others have reported using this approach fixed their compiler errors/allowed them to get CI builds.

    Has anyone encountered this or explored other solutions after trying the ones in this thread?
     
  8. talofa-parker

    talofa-parker

    Joined:
    May 26, 2021
    Posts:
    3
    Hi everyone, we've also iterated on the script solution provided by Blackbox realities:
    Code (CSharp):
    1. using System;
    2.   using UnityEngine;
    3.   using UnityEditor;
    4.   using System.IO;
    5.   using System.Collections.Generic;
    6.  
    7.   /// <summary>
    8.   /// A fix for Cloud Build while using Wwise. Add to Editor Folder
    9.   /// Based on solution from Blackbox Relaities: https://github.com/BlackBoxSimulations/wwise-unity-cloud-build-fixer
    10.   /// </summary>
    11.   public class WwiseFixEditor : MonoBehaviour
    12.   {
    13.     class WwiseReplacement
    14.     {
    15.       private string Original;
    16.       private string Replacement;
    17.  
    18.       public WwiseReplacement(string original, string replacement)
    19.       {
    20.         Original = original;
    21.         Replacement = replacement;
    22.       }
    23.  
    24.       public bool ReplaceIfNecessary(string input, out string output)
    25.       {
    26.         if (input.Equals(Original, StringComparison.OrdinalIgnoreCase))
    27.         {
    28.           output = Replacement;
    29.           return true;
    30.         }
    31.         else if (input.Contains(Original))
    32.         {
    33.           output = input.Replace(Original, Replacement);
    34.           return true;
    35.         }
    36.         else
    37.         {
    38.           output = null;
    39.           return false;
    40.         }
    41.       }
    42.  
    43.       public bool ReverseReplaceIfNecessary(string input, out string output)
    44.       {
    45.         if (input.Equals(Replacement, StringComparison.OrdinalIgnoreCase))
    46.         {
    47.           output = Original;
    48.           return true;
    49.         }
    50.         else if (input.Contains(Replacement))
    51.         {
    52.           output = input.Replace(Replacement, Original);
    53.           return true;
    54.         }
    55.         else
    56.         {
    57.           output = null;
    58.           return false;
    59.         }
    60.       }
    61.     }
    62.  
    63.     private static WwiseReplacement[] WwisePatches =
    64.     {
    65.       // Mac
    66.       new WwiseReplacement("#if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || UNITY_EDITOR_OSX", "#if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || (UNITY_EDITOR_OSX && !UNITY_STANDALONE_WIN)"),
    67.       // Windows
    68.       new WwiseReplacement("#if (UNITY_STANDALONE_WIN && !UNITY_EDITOR) || UNITY_EDITOR_WIN", "#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN || UNITY_WSA"),
    69.       //Linux
    70.       new WwiseReplacement("#if UNITY_STANDALONE_LINUX && ! UNITY_EDITOR", "#if UNITY_EDITOR || (UNITY_STANDALONE_LINUX && !UNITY_EDITOR)"),
    71.       new WwiseReplacement("#if UNITY_STANDALONE_LINUX && !UNITY_EDITOR", "#if UNITY_EDITOR || (UNITY_STANDALONE_LINUX && !UNITY_EDITOR)"),
    72.       // Android
    73.       new WwiseReplacement("#if UNITY_ANDROID && !UNITY_EDITOR", "#if (UNITY_ANDROID && !UNITY_EDITOR) || (UNITY_ANDROID && UNITY_EDITOR_LINUX)"),
    74.       new WwiseReplacement("#if UNITY_ANDROID && ! UNITY_EDITOR", "#if (UNITY_ANDROID && !UNITY_EDITOR) || (UNITY_ANDROID && UNITY_EDITOR_LINUX)"),
    75.       // iOS
    76.       new WwiseReplacement("#if (UNITY_IOS && !UNITY_EDITOR) || (UNITY_IOS && UNITY_EDITOR_LINUX)", "#if UNITY_IOS && !UNITY_EDITOR"),
    77.       //new WwiseReplacement("#if UNITY_IOS && ! UNITY_EDITOR", "#if (UNITY_IOS && !UNITY_EDITOR) || (UNITY_IOS && UNITY_EDITOR_LINUX)"),
    78.       new WwiseReplacement("#if (UNITY_IOS || UNITY_TVOS) && !UNITY_EDITOR", "#if (UNITY_IOS && !UNITY_EDITOR) || (UNITY_IOS && UNITY_EDTIOR_LINUX)"),
    79.       new WwiseReplacement("#if (UNITY_IOS && !UNITY_EDITOR) || (UNITY_IOS && UNITY_EDTIOR_LINUX) || (UNITY_TVOS && !UNITY_EDITOR) || (UNITY_TVOS && UNITY_EDITOR_LINUX)", "#if (UNITY_IOS && !UNITY_EDITOR) || (UNITY_IOS && UNITY_EDTIOR_LINUX)"),
    80.       // Switch
    81.       new WwiseReplacement("#if (UNITY_SWITCH || UNITY_ANDROID || UNITY_STANDALONE_LINUX || UNITY_STADIA) && !UNITY_EDITOR", "#if (UNITY_SWITCH || UNITY_ANDROID || UNITY_STANDALONE_LINUX || UNITY_STADIA) && (!UNITY_EDITOR || UNITY_EDITOR_LINUX)")
    82.     };
    83.  
    84.     public static void ApplyWwiseScriptsFix()
    85.     {
    86.       ModifyWwiseScriptsTempFix(false);
    87.     }
    88.  
    89.     public static void RemoveWwiseScriptsFix()
    90.     {
    91.       ModifyWwiseScriptsTempFix(true);
    92.     }
    93.  
    94.     private static void ModifyWwiseScriptsTempFix(bool undo)
    95.     {
    96.       string path = EditorUtility.OpenFolderPanel("Wwise Root Folder in Assets", "", "");
    97.       GetDirectories(path, undo);
    98.       AssetDatabase.Refresh();
    99.     }
    100.  
    101.     public static void GetDirectories(string path, bool undo)
    102.     {
    103.       string[] directories = Directory.GetDirectories(path);
    104.       ReplaceFiles(Directory.GetFiles(path), path, undo);
    105.  
    106.       foreach (string directory in directories)
    107.         GetDirectories(directory, undo);
    108.     }
    109.  
    110.     private static void ReplaceFiles(string[] files, string path, bool undo)
    111.     {
    112.       foreach (string file in files)
    113.       {
    114.         if (file.EndsWith(".cs"))
    115.         {
    116.           var text = File.ReadAllText(file);
    117.           var split = text.Split(Environment.NewLine.ToCharArray());
    118.           Debug.Log(String.Join("|", Environment.NewLine.ToCharArray()));
    119.  
    120.           for (int i = 0; i < split.Length; i++)
    121.           {
    122.             foreach (WwiseReplacement patch in WwisePatches)
    123.             {
    124.               if (undo)
    125.               {
    126.                 if (patch.ReverseReplaceIfNecessary(split[i], out string result))
    127.                 {
    128.                   // Stop trying to replace things after the first replacement occurs
    129.                   split[i] = result;
    130.                   break;
    131.                 }
    132.               }
    133.               else
    134.               {
    135.                 if (patch.ReplaceIfNecessary(split[i], out string result))
    136.                 {
    137.                   // Stop trying to replace things after the first replacement occurs
    138.                   split[i] = result;
    139.                   break;
    140.                 }
    141.               }
    142.             }
    143.           }
    144.  
    145.           List<string> nonBlankLines = new List<string>();
    146.           foreach (string line in split)
    147.           {
    148.             if (!string.IsNullOrWhiteSpace(line))
    149.               nonBlankLines.Add(line);
    150.           }
    151.  
    152.           File.WriteAllLines(file, nonBlankLines);
    153.         }
    154.       }
    155.     }
    156.  
    157.     public static void SetReleaseSetting()
    158.     {
    159.       AkPluginActivator.ActivateRelease();
    160.     }
    161.   }
    These changes create a new
    WwiseReplacement(old, new)
    class, where you specify the original preprocessor directives with what you want to replace them with. This script also gives you the ability to undo any changes the script compiles by reversing the parameters to replace new text with the original.

    For example, if you want to change the OSX preprocessing directives, create a new WwiseReplacement in the
    WwisePatches

    array and pass in the default text to the first parameter, followed by what you'd like to replace it with.
    new WwiseReplacement("#if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || UNITY_EDITOR_OSX", "#if (UNITY_STANDALONE_OSX && !UNITY_EDITOR) || (UNITY_EDITOR_OSX && !UNITY_STANDALONE_WIN)")
     
    st-VALVe likes this.
  9. eazymtg

    eazymtg

    Joined:
    Nov 21, 2020
    Posts:
    1
    I had the same problem, to build with Linux. I used the above script from @talofa-parker, with the following replacements for Linux :
    Code (CSharp):
    1. //Linux
    2.       new WwiseReplacement("#if UNITY_STANDALONE_LINUX && ! UNITY_EDITOR", "#if UNITY_EDITOR_LINUX || (UNITY_STANDALONE_LINUX && !UNITY_EDITOR)"),
    3.       new WwiseReplacement("#if UNITY_STANDALONE_LINUX && !UNITY_EDITOR", "#if UNITY_EDITOR_LINUX || (UNITY_STANDALONE_LINUX && !UNITY_EDITOR)"),
    4.       new WwiseReplacement("#if (UNITY_SWITCH || UNITY_ANDROID || UNITY_STANDALONE_LINUX || UNITY_WEBGL) && !UNITY_EDITOR", "#if ((UNITY_SWITCH || UNITY_ANDROID || UNITY_STANDALONE_LINUX || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_EDITOR_LINUX")
    It worked perfectly !