An other solution

Hello

I do not like having to look for NULL pointers everywhere in my code. This “solution” may not be ideal but for now it works nicely and I don’t have a crash either. Sorry, I’m not english and it’s difficult to explain everything, what I have in mind. I make this check in the BeginPlay member function.

if (PressurePlate == nullptr)
{
	UE_LOG(LogTemp, Error, TEXT("%s is missing a PressurePlate, PLEASE ADD ONE NOW OR THE GAME WON'T WORK !!!!"), *GetOwner()->GetName());
	SetComponentTickEnabled(false);
}

An other solution, would be to use assertions ! Read this to learn more : Unreal Assertions

Privacy & Terms