It just poped out of nowhere.
There is full relevelant communicate from log:
D:\BuildFarm\buildmachine_++depot+UE4-Rocket+Beta6\Engine\Source\Runtime\Engine\Private\UnrealEngine.cpp(7882): Ensure condition failed: false
Unsupported context object of class Effect10s_C (SuperClass(es) - RPGEffectBase, Object). You must add a way to retrieve context to a class in the hierarchy.
RocketEditor.exe has triggered a breakpoint.
It happens because I try to use:
UFUNCTION(BlueprintImplementableEvent, Category=AbilityEffects)
void OnEffectAppiled();
In my blueprint.
Then it break here:
IMPLEMENT_CLASS(URPGEffectBase);
void URPGEffectBase::OnEffectAppiled()
{
ProcessEvent(FindFunctionChecked(RPG_OnEffectAppiled),NULL);
}
In RPG.generated.inl
And this is my header file:
#pragma once
#include "RPGEffectBase.generated.h"
//DECLARE_DYNAMIC_MULTICAST_DELEGATE(FEffectAppiledToTarget);
enum EffectAlligment
{
Effect_Negative,
Effect_Neutral,
Effect_Positive
};
/**
*
*/
UCLASS(Blueprintable)
class URPGEffectBase : public UObject
{
GENERATED_UCLASS_BODY()
(...)
Here is where event is called in code:
void URPGEffectBase::Initialize()
{
ARPGCharacter* GC = Cast(AffectedTarget);
if(GC)
{
OnEffectAppiled();
//OnEffectAppiledtoTarget.Broadcast();
UWorld* world = GetCurrentWorld(GC);
if(world)
{
if(ShouldEffectTick)
{
FTimerDynamicDelegate eventTick;
eventTick.BindDynamic(this, &URPGEffectBase::SetEffectTick);
world->GetTimerManager().SetTimer(eventTick, TickDuration, true);
}
FTimerDynamicDelegate tdd;
tdd.BindDynamic(this, &URPGEffectBase::RemoveFromArray);
world->GetTimerManager().SetTimer(tdd, Duration, false);
FTimerDelegate td;
td.BindUObject(this, &URPGEffectBase::SetOnEffectRemoved);
world->GetTimerManager().SetTimer(td, Duration, false);
}
}
}
And here is how it is added to character:
void URPGEffectManagerComponent::AddEffect(URPGEffectBase* newEffect)
{
newEffect->Initialize();
EffectsList.Add(newEffect);
//FTimerDelegate td;
}
And there blueprint function that is used to apply:
void URPGEffectBPLibrary::ApplyEffect(AActor* effectTarget, AActor* causedBy, TSubclassOf appiledEffect)
{
ARPGCharacter* GC = Cast(effectTarget);
if(GC)
{
if(appiledEffect)
{
//static ConstructorHelpers::FObjectFinder spawnEffect (appiledEffect.Class);
//GC->EffectManager->EffectsList.Add(appiledEffect.GetDefaultObject());
URPGEffectBase* effect = ConstructObject(appiledEffect);
effect->AffectedTarget = effectTarget;
effect->CausedBy = causedBy;
GC->EffectManager->AddEffect(effect);
}
}
}
It does not cause crash, only this annoying break.
Moreover it happen only on first usage of said event. After that any other usage of this event work fine.