Hey,
In InteractableActor.h
I have this event
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio|FMOD")
UFMODEvent* ScrapeEvent;
I created BP_Interactable
blueprint and it’s have InteractableActor
as parent, and I’ve set ScrapeEvent
to Scrape_Wood
event, but in this code:
void AInteractableActor::BeginPlay()
{
Super::BeginPlay();
PreviousLocation = GetActorLocation();
MeshComponent->OnComponentHit.AddDynamic(this, &AInteractableActor::OnHit);
if (ScrapeEvent != nullptr)
{
FMOD::Studio::EventDescription* scrapeDescription = IFMODStudioModule::Get().GetEventDescription(ScrapeEvent, EFMODSystemContext::Runtime);
scrapeDescription->createInstance(&ScrapeInstance);
Print("Created instance from Scrape Event!", 1);
} else
{
Print("Scrape Event is not set!", 1);
}
}
Print("Scrape Event is not set!", 1);
is called - the question is why, because I have ScrapeEvent
set in my Blueprint.
Also - in BP_Interactable
I’ve added these nodes, and it returns that ScrapeEvent is valid.
EDIT:
I removed if (ScrapeEvent != nullptr)
and now it works, but how could I check if event is valid? if (ScrapeEvent)
doesnt work too.