Hi, for a project I have made a base-class (BouncingPadManager) in C++.
This base class is spawned and managed by the game mode.
#pragma once
// ...includes here
UCLASS()
class GAMEPROJECT_API ABouncePadManager : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
UFUNCTION(BlueprintImplementableEvent, Category="Events")
void OnScoreEvent(FTeamScore nativeSide, FTeamScore invaderSide); // no implementation in cpp
UFUNCTION(BlueprintImplementableEvent, Category="Events")
void OnGameEnd(); // no implementation in cpp
// ...here be more stuff
};
When a player scores this event gets called in the gamemode.
In tick the delegate also broadcasts fine and the output is as expected.
In the implemented OnScoreEvent (from the base c++ class) the delegate never calls anything so no output/desired behavior is produced. Any other code besides the delegates works fine(parameters were disconnected to simplify example.)
A breakpoint in OnScoreEvent gets triggered, the C++ Doesn’t have an implementation so no nothing triggers. I have tried adding an implementation but the compiler won’t except it.
Error: BouncePadManager.cpp.obj : error LNK2005: "public: void __cdecl ABouncePadManager::OnScoreEvent(struct FTeamScore,struct FTeamScore)" (?OnScoreEvent@ABouncePadManager@@QEAAXUFTeamScore@@0@Z) already defined in BouncePadManager.gen.cpp.obj
I have found a way around the problem by just directly calling the function on a bouncing pad instead, but I just wish to know the reason why my initial approach didn’t work.