Alternative implementation

void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

float CurrentTimeSeconds = GetWorld()->GetTimeSeconds();

if (PressurePlate) {
	// Player enters TriggerVolume
	if (PressurePlate->IsOverlappingActor(ActorThatOpens)) 
	{
		CloseDoorAtTime = CurrentTimeSeconds + DoorCloseDelay;	
		OpenDoor();
	}

	// Close door after time
	if (CloseDoorAtTime < CurrentTimeSeconds) 
	{
		CloseDoor();
	}
}

}

Privacy & Terms