i had been trying to do like the youtube tutorial of creating a pickup battery( - YouTube
)[link text][1] the BasePickup was okay but after writing the BatteryPickup class it is showing like this
" Error 1 error C2084: function ‘ABatteryPickup::ABatteryPickup(void)’ already has a body C:\Users\Benhur joseph\Documents\Unreal Projects\Pickup\Source\Pickup\BatteryPickup.cpp 8 1 Pickup"
can you show your base APickupActor header file listing? Anyway in your current class definition you didn’t define constructor method:
ABatteryPickup();
(ApickupActor.cpp also contains the BlueprintNativeEvent defined which is not shown in the image.it is defined as shown below .
.
//define what happens when picked up
void APickupActor::OnPickedup_Implementation()
{
//there is no default behavior
}
iam totally new to these programming . so hope you elaborate on my mistakes.thank you.
in PickupActor.h you don’t need to define OnPickedup_Implementation. That’s one of those things that engine does for you itself.
in BatteryPickup.h you need define default constructor for class - I mean ABatteryPickup();. For now you do implement it in *.cpp file but don’t define in *.h file
thank you for pointing out my careless mistake . but something about the buleprintNative Event i done here .
i removed the " virtual void OnPickedup_Implementation() " line from the APickupActor.h but then i cannot override it in my ABatteryPickup class . the override defining line “void OnPickedup_Implementation()override;” will shown as as a error
i don’t think that is a problem because Pickup.h is the project file . my project’s name is Pickup. also all the #include are automatically added by visualstudio when i created the class in unreal editor using class wizard . i didn’t mess anything there .
i tried rebuilding it and many other possibilities like making it virtual void in cpp file for writing the function , but every time i got error at the same place saying Onpickedup_Implemetation is not a member of ApickupActor .i guess for overriding from a base class OnPickedup_Implementation needs to be defined as a virtual void in the header file.