I have a quick blot of code meant to run during the start of an attack animation’s notify, to let the combat system know that it should start drawing debugspheres to show the attack’s hitboxes:
void UHitframeNotifyState::NotifyBegin(USkeletalMeshComponent * MeshComp, UAnimSequenceBase * Animation, float TotalDuration){
ULexicon* myLexicon = MeshComp->GetOwner()->FindComponentByClass<ULexicon>(); //Find the Lexicon component on the character running this animation
if (myLexicon != nullptr) //If that component exists...
myLexicon->showBoxes = true; //Tell it to start visualizing hitboxes
}
It works perfectly when I run the game, but if I try to open persona without commenting this code out, UE4 crashes. I’m assuming the crash occurs because my NotifyBegin runs in persona, but doesn’t have a component to find and point at, but having to comment my debugging code out every time I want to edit an animation is super-inconvenient: is there any way to either flag this to only execute in-game, or alter it to prevent the crash from occuring in the first place?