Protecting From A Null Pointer with Asserts

Just for fun I decided to try out the Asserts.
[https://docs.unrealengine.com/en-US/Programming/Assertions/index.html]

So code ended up something like this:

	if (ensureMsgf(bWasInitialized, TEXT("%s PressurePlate ran Tick() with bWasInitialized == false"), *GetOwner()->GetName()))
	{
		if (PressurePlate && PressurePlate->IsOverlappingActor(ActorThatOpensDoor))
		{
			OpenDoor(DeltaTime);
		}
	}

Privacy & Terms