x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

'ReceiveActorBeginOverlap' marked 'override' but does not override any member functions

Hi everyone. (Hoping this isn't already asked, already looked but probably didn't look hard enough since I couldn't find a solution)

I am trying to detect collision in my first person shooter using UE 4.9. I try to compile my code but receive

"'ReceiveActorBeginOverlap' marked 'override' but does not override any member functions"

in my error log. My header file, where the error is pointing to, looks like this:

 #pragma once
  #include "GameFramework/Actor.h"
  #include "HealthPack.generated.h"

 UCLASS()
 class TESTFPS_API AHealthPack : public AActor
 {
     GENERATED_BODY()
 
 public:    
     AHealthPack();    
     AHealthPack(const FObjectInitializer& ObjectInitializer);    

     virtual void     BeginPlay()  override;
     virtual void     Tick( float DeltaSeconds ) override;
     virtual void     ReceiveActorBeginOverlap(class AActor* Other)    override;    

And in my .cpp implementation file l declare this method like this:

 void AHealthPack::ReceiveActorBeginOverlap(class AActor* Other)    
 {
      if (Other != NULL)
     {
         if (CanBePickedUp(Cast<ATestFPSCharacter>(Other)))
         {
             HandlePickUp(Cast<ATestFPSCharacter>(Other));
             HandleEffects();
             removeFromWorld();
         }
     }
 }

Just a side note that ATestFPSCharacter is my character class which is an autogenerated file from the First Person Shooter template that imports "GameFrameWork/Character.h"

Does anybody know what I'm doing wrong? I'm quite new to UE4 (but ok with C++ using a different game engine)

Any help or tips would be greatly appreciated. Thanks!

Ben

Product Version: UE 4.9
Tags:
more ▼

asked Sep 20 '15 at 10:07 AM in C++ Programming

avatar image

hairspray011
8 6 5 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi,

You can't override method that aren't marked as virtual, ReceiveActorBeginOverlap isn't virtual.

Override NotifyActorBeginOverlap but remember to call Super in your function.

Regards

Piotr

more ▼

answered Sep 20 '15 at 10:52 AM

avatar image

Pierdek
2.6k 73 49 131

avatar image hairspray011 Sep 20 '15 at 12:12 PM

Awesome this did the trick. Cheers mate, ur a star!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question