I am trying to make guns for a FPS shooter, I had it all set up and working in blueprints using blueprint interfaces, but they have been corrupting my blueprints. I’ve made an answerhub question and have spoken with the devs, they are likely looking at my problem, but in the meantime I’d like to look at a C++ solution. The guns I’ve made have been based off the Actor class, and I’d like to make a subclass so that I can easily reference and control them. Example, store ‘Gun A’ reference into an ActiveWeapon variable, and then just use a command like ActiveWeapon -> Shoot. Each gun then can handle its line trace and whatever else it needs to do.
I’ve been trying to follow several tutorials, and for one brief moment I had it partially working, but I cant seem to get a custom function or event to show up in my blueprints. Using the FPS blueprint project base, I did “Add code to project”. From what I can discern from the tutorials, this code should get me an event in the blueprint:
// MyActor.h
//
UCLASS()
class TESTFPS1_API AMyActor : public AActor
{
GENERATED_UCLASS_BODY()
public:
UFUNCTION(BlueprintCallable, Category=Gun)
void Shoot();
};
//MyActor.cpp
//
AMyActor::AMyActor(const class FObjectInitializer& PCIP)
: Super(PCIP)
{
}
void AMyActor::Shoot()
{
// this does nothing! NOTHING!!!
}
I’ve tried BlueprintImplementableEvent as well, and even a combination, but nothing shows up in the blueprints after compiling with no errors. Solution Configurations is in DebugGame. It even says “1> Compiling game modules for hot reload” when I compile.