C++ Lecture 148, ToonTanks

Hey guys,

I’m on Unreal Engine 4.26.1, I Need help with AddDynamic in this specific lecture. Instructor Rob said that there are errors with compiling this code:

ProjectileMesh->OnComponentHit.AddDynamic(this, &AProjectileBase::OnHit);

and the solution was to delete and recreate the the BP_ProjectileBase but it doesnt work for me.

Things I tried:
• moved the code under begin play and compiled, still get the error


• Deleted the BP_ProjectileBase blueprint and recompiled, I get the error.
• Deleted the BP_ProjectileBase blueprint and move the code under begin play and compiled, still get the error
• Deleted the BP_ProjectileBase blueprint and recompiled within VS Code, still get the error
• Deleted the BP_ProjectileBase blueprint, and move the code under begin play and recompiled within VS Code, still get the error

I searched the forums and google but im not getting any positive results. please send help :frowning:

here is the entire ProjectileBase.ccp

here is the error log after recompiling

I believe it’s complaining about your class as it doesn’t consider it a UPrimitiveComponent, not entirely sure why, and I only answered since I looked earlier and didn’t see any response yet, so there is a chance I’m off. Hopefully that helps give a place to look at least, holler if it helps (or if the answer turns out to be something else).

you know what, you are completely right. I checked the GitHub commit for this lecture and compared notes on what I missed and I missed something big time.

Instead of

UFUNCTION()
	void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);

what I did was

UFUNCTION()

void OnHit(UProjectileMovementComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);

I probably hit tab to auto complete that function when i was typing the code.

thanks, XavierMagnus!

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

Privacy & Terms