Download

Custom AudioVolume FInterirorSettings linker error

Hi,

I made a custom audio volume to execute blueprint events when we enter / exit it but I have a linker error on the FInterirorSettings variable I declare in CheckAudioVolume function.

Anyone has any idea on this problem ? My header include the AudioVolume class where the struct is defined.

Thansk a lot for any help.


// Copyright Moonycat Entertainment, All Rights Reserved

#include "Metaphora_Test.h"
#include "META_AudioVolume.h"

#include "Audio/META_AudioGraph.h"


// Called at begin play
void AMETA_AudioVolume::BeginPlay()
{
    Super::BeginPlay();

    // Spawn audio graph
    UWorld* world = GetWorld();

    if (m_AudioGraphClass != nullptr && world != nullptr)
    {
        m_AudioGraph = world->SpawnActor<AMETA_AudioGraph>(m_AudioGraphClass, GetActorLocation(), GetActorRotation());
    }
}

// Called every frame
void AMETA_AudioVolume::Tick(float DeltaSeconds)
{
    Super::Tick(DeltaSeconds);

    // Check audio volume state
    CheckAudioVolumeState();
}

// Check for audio volume state and trigger audio graph if needed
void AMETA_AudioVolume::CheckAudioVolumeState()
{
    UWorld* world = GetWorld();

    if (world != nullptr)
    {
        FReverbSettings reverbSettings;
        FInteriorSettings interiorSettings;*** // LINKER ERROR HERE, unresolved external symbol etc***
        APlayerController* playerController = UGameplayStatics::GetPlayerController(this, 0);

        if (playerController == nullptr || playerController->GetViewTarget() == nullptr)
            return;

        AAudioVolume* activeAudioVolume = world->GetAudioSettings(playerController->GetViewTarget()->GetActorLocation(), &reverbSettings, &interiorSettings);

        if (activeAudioVolume == this)
        {
            if (!m_IsActiveAudioVolume)
            {
                // Trigger audio graph
                if (m_AudioGraph != nullptr)
                    m_AudioGraph->OnTriggerEnter();

                m_IsActiveAudioVolume = true;
            }
        }
        else
        {
            if (m_IsActiveAudioVolume)
            {
                // Trigger audio graph
                if (m_AudioGraph != nullptr)
                    m_AudioGraph->OnTriggerExit();

                m_IsActiveAudioVolume = false;
            }
        }
    }
}