[FMOD] UE4.6.0 support - Temporary fix while waiting official FMOD release

Hi,
This is not a question but just a fix that I wanted to share with people running UE4.6 and being blocked with projects using FMOD plugin for UE4.5.1 (until the release of the official FMOD 4.6 Plugin).

If you are using UE4 that you build yourself though source code then here is how I’ve updated the only required FMOD source file, in order to run the current plugin version (UE4.5.1) within UE4.6.0

Go to: UnrealEngine\Engine\Plugins\FMODStudio\Source\FMODStudioEditor\Private\FMODStudioEditorModule.cpp

Remove the include of Settings.h

Add the following includes

#include "ISettingsModule.h"
#include "ISettingsSection.h"

The way to get a reference to the module has been changed, the ISettingsModule::Get() method has been replaced by a method used by FModuleManager. Also, the delegate mecanism is now using a shortcut for registering settings. Here is the updated method startupModule:

void FFMODStudioEditorModule::StartupModule()
{
    UE_LOG(LogFMOD, Verbose, TEXT("FFMODStudioEditorModule startup\n"));

    AssetBroker = MakeShareable(new FFMODAssetBroker);
    FComponentAssetBrokerage::RegisterBroker(AssetBroker, UFMODAudioComponent::StaticClass(), true, true);

    if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
    {
        ISettingsSectionPtr SettingsSection = SettingsModule->RegisterSettings("Project", "Plugins", "FMODStudio",
            LOCTEXT("FMODStudioSettingsName", "FMOD Studio"),
            LOCTEXT("FMODStudioDescription", "Configure the FMOD Studio plugin"),
            GetMutableDefault<UFMODSettings>()
        );

        if (SettingsSection.IsValid())
        {
            SettingsSection->OnModified().BindRaw(this, &FFMODStudioEditorModule::HandleSettingsSaved);
        }
    }

    MainMenuExtender = MakeShareable(new FExtender);
    MainMenuExtender->AddMenuExtension("HelpBrowse", EExtensionHook::After, NULL, FMenuExtensionDelegate::CreateRaw(this, &FFMODStudioEditorModule::AddHelpMenuExtension));
    FLevelEditorModule* LevelEditorModule = FModuleManager::GetModulePtr<FLevelEditorModule>( "LevelEditor" );
    if (LevelEditorModule)
    {
        LevelEditorModule->GetMenuExtensibilityManager()->AddExtender(MainMenuExtender);
    }

    // Register slate style overrides
    FFMODStudioStyle::Initialize();

    FEditorDelegates::BeginPIE.AddRaw(this, &FFMODStudioEditorModule::BeginPIE);
    FEditorDelegates::EndPIE.AddRaw(this, &FFMODStudioEditorModule::EndPIE);
    FEditorDelegates::PausePIE.AddRaw(this, &FFMODStudioEditorModule::PausePIE);
    FEditorDelegates::ResumePIE.AddRaw(this, &FFMODStudioEditorModule::ResumePIE);

    ViewportDrawingDelegate = FDebugDrawDelegate::CreateRaw(this, &FFMODStudioEditorModule::ViewportDraw);
    UDebugDrawService::Register(TEXT("Editor"), ViewportDrawingDelegate);

    OnTick = FTickerDelegate::CreateRaw( this, &FFMODStudioEditorModule::Tick );
    FTicker::GetCoreTicker().AddTicker( OnTick );
}

Also, at the end of the file, line 264, for unregistering the module:

if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
    {
        SettingsModule->UnregisterSettings("Project", "Plugins", "FMODStudio");
    }

Note that the include of Slate.h is now deprecated. I’ve just removed it from the file to avoid the warning and the solution still compiles and run without any issue. Slate seems to be integrated seemlessly now.

After that I was able to run again my Project which is usiing FMOD Audio components created with the current FMOD Studio 1.05.08 without issues.

This is just a temporary fix used in order to (continue) work(ing) and run projects using FMOD plugin builded for UE4.5.1into UE4.6., until FMOD team releases the official one.

No need an answer this time :wink: