in case this can help find a fix for Unity MPPM, here’s the hackish updates I did to get fmod 2.03.08 working in the virtual player of MPPM:
in Assets/Plugins/FMOD/src/RuntimeUtils.cs, added this method:
public static string ToVirtualPlayerFriendlyPath(string bankPath)
{
#if UNITY_EDITOR
if (IsVirtualPlayer() == false)
{
// Editor: regular player, leave the path as is.
return bankPath;
}
return System.IO.Path.Combine("../../../", bankPath);
// https://discussions.unity.com/t/multiplayer-play-mode-get-player-id/1578742/3
bool IsVirtualPlayer()
{
const string vpIdArg = "-vpId";
var args = Environment.GetCommandLineArgs();
foreach (var arg in args)
{
if (arg.StartsWith(vpIdArg))
{
return true;
}
}
return false;
}
#else
// Runtime: do not adjust the path in any way.
return bankPath;
#endif
}
…
and I use it in
FMODUnity.PlatformPlayInEditor.GetBankFolder
//string bankFolder = globalSettings.SourceBankPath;
string bankFolder = RuntimeUtils.ToVirtualPlayerFriendlyPath(globalSettings.SourceBankPath);
FMODUnity.BankRefresher.UpdateFileWatcherPath
//string sourceBankPath = Settings.Instance.SourceBankPath;
string sourceBankPath = RuntimeUtils.ToVirtualPlayerFriendlyPath(Settings.Instance.SourceBankPath);
FMODUnity.EditorUtils.ValidateSource
// if (!File.Exists(settings.SourceProjectPath))
if (!File.Exists(RuntimeUtils.ToVirtualPlayerFriendlyPath(settings.SourceProjectPath)))
[...]
// string buildFolder = RuntimeUtils.GetCommonPlatformPath(Path.Combine(projectFolder, BuildFolder));
string buildFolder = RuntimeUtils.ToVirtualPlayerFriendlyPath(RuntimeUtils.GetCommonPlatformPath(Path.Combine(projectFolder, BuildFolder)));
FMODUnity.EventManager.UpdateCache
//defaultBankFolder = RuntimeUtils.GetCommonPlatformPath(Path.Combine(settings.SourceBankPath, platform.BuildDirectory));
defaultBankFolder = RuntimeUtils.ToVirtualPlayerFriendlyPath(RuntimeUtils.GetCommonPlatformPath(Path.Combine(settings.SourceBankPath, platform.BuildDirectory)));
with those changes, sounds work in both main editor and MPPM “virtual players”.