Don't Need "Float DeltaTime" in OpenDoor?

Hi, I just wanted a refresher on why we don’t need to say OpenDoor(float DeltaTime); in our implementation in TickComponent.

To understand you better could you provide code of the code you’re seeing and what you’re expecting?

Yes, I’m talking about this:

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

	if (PressurePlate && PressurePlate->IsOverlappingActor(ActorThatOpens))
	{
		OpenDoor(DeltaTime);
	}
}

In the void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) part, we have to say “float DeltaTime” but in the implementation, we only say “DeltaTime”.

Because the parameter defines it. It’s no different to this

int x = 5;
std::cout << x << '\n';

x was defined on the first line. You don’t write

int x = 5;
std::cout << int x << '\n';
1 Like

Thanks!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms