Implementation error

Currently I’m working on this this tutorial (it’s pretty outdated API, but in comments I found actual version of the code 4.7.5). And I have some problems with it:

  1. adding _Implementation() - Visual Studio highlights it as error! Am I doing something wrong?
  2. To call ObjectInitializer we must introduce it in function, like this APickup::APickup(const FObjectInitializer& ObjectInitializer)? Visual Studio mark this as error, telling me that "No instance of overloaded function APickUp::APickUp". Do I missed something?
  3. Do internet have updated tutorials for C++ in Unreal, except of API?

Hi yarpoplar,

If _Implementation() is giving you issues, please be sure that you have already declared the function in the .h file and also defined the function without the implementation before it such as:

APickUp::OnPickedUp()
{

}

APickUp::OnPickedUp_Implementation()
{
      //Your code here
}

I don’t understand why that would be giving you an issue. Are you defining this in the .cpp or the .h? Be sure that you are not trying to declare it in the .h before defining in the .cpp, as the ‘GENERATED_UCLASS_BODY’ that is being used in the tutorial takes care of the declaring for you. If you are using 'GENERATED_BODY" however, be sure to add the following to the .h

APickUp(const FObjectInitializer& ObjectIntializer);

as a declaration.

The only tutorials we have that are kept up to date on a regular basis are the documentation ones that you mentioned. I would suggest that you check out the community wiki as a lot of users make tutorials of their own to help others.

I hope this information helps!

Matthew Clark

Thank you very much!
What difference between ‘GENERATED_UCLASS_BODY’ and ‘GENERATED_BODY’?

Hello, yarpolar

GENERATED_BODY() is the new version of GENERATED_UCLASS_BODY() macro.

When using GENERATED_BODY(), you don’t have to implement a constructor for each class (however, you can do it if you need one).
Another difference is that GENERATED_BODY() macro doesn’t have “public:” keyword in it. Thus, all class members, declared after it are private by default (as in every class in pure C++), so you have to explicitly declare access specifiers for them in case you want to change this.

Hope this helped!

Good luck!