Files
Brandyn / Techy fcc1b09210 init
2026-04-04 15:40:51 -05:00

38 lines
913 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "ComponentAssetBroker.h"
#include "NiagaraComponent.h"
#include "NiagaraSystem.h"
class FNiagaraComponentBroker : public IComponentAssetBroker
{
public:
UClass* GetSupportedAssetClass() override
{
return UNiagaraSystem::StaticClass();
}
virtual bool AssignAssetToComponent(UActorComponent* InComponent, UObject* InAsset) override
{
if (UNiagaraComponent* NiagaraComponent = Cast<UNiagaraComponent>(InComponent))
{
if (UNiagaraSystem* NiagaraSystem = Cast<UNiagaraSystem>(InAsset))
{
NiagaraComponent->SetAsset(NiagaraSystem);
return true;
}
}
return false;
}
virtual UObject* GetAssetFromComponent(UActorComponent* InComponent) override
{
if (UNiagaraComponent* NiagaraComponent = Cast<UNiagaraComponent>(InComponent))
{
return NiagaraComponent->GetFXSystemAsset();
}
return nullptr;
}
};