TickComponent fails to call member functions

I’m having this weird issue where my TickComponent function is not calling other member functions in the same class.

The following works fine:

void UHealthComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
    if (!HealthBarWidget) return;
    HealthBarWidget->SetHealth(HealthPoints);
    HealthBarWidget->SetMaximumHealth(MaximumHealthPoints);
    ElapsedTime += DeltaTime;
    if (ElapsedTime > 2.f)
    {
        HealthPoints -= 100;
        ElapsedTime = 0;
    }
}

But the following doesn’t:

void UHealthComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
    if (!HealthBarWidget) return;
    DrainHealth(DeltaTime);
    UpdateWidget();
}

void UHealthComponent::DrainHealth(float deltaTime)
{
    ElapsedTime += deltaTime;
    if (ElapsedTime > 2.f)
    {
        MutateHealth(-100);
        ElapsedTime = 0;
    }
}

void UHealthComponent::UpdateWidget()
{
    if (!HealthBarWidget) return;
    HealthBarWidget->SetHealth(HealthPoints);
    HealthBarWidget->SetMaximumHealth(MaximumHealthPoints);
}

void UHealthComponent::MutateHealth(int32 deltaHealthPoints)
{
    HealthPoints -= deltaHealthPoints;
}

What’s really weird is that the debugger will hit the breakpoint where the function is called but it won’t actually step into the function. The functions just aren’t getting called at all.

Can anyone point me in the right direction? Also: they all have the same access modifier: protected.

Even though the optimizer was indeed inlining my functions, there was a bug in my code that caused me to think the functions weren’t working at all… I caught this by using #pragma optimize and stepping through my code.

HealthPoints -= deltaHealthPoints

should instead be

HealthPoints += deltaHealthPoints

Silly me.