Though even the first step of the code bit about adding the code to the headers is giving me errors. The autogenerated class has like no constructor for .cpp and the header file has an error for the FPSGameMode.generated.h file in #include.
class FPSPROJECT_API AFPSGameMode : public AGameMode
virtual void StartPlay() override;
Its quite common to see errors with the generated include files if you have other errors, that’s because they probably haven’t been generated yet (they are generated when you build) because of the other errors prevent it from ever getting to that point. At first glance, your code seems fine, but do you have the associated ‘.cpp’ file also created? If so can you show it?
The weird thing is, it is saying the class “UVertexAnimBase” but the Super::BeginPlay() should be referring to FPSGameMode.h’s BeginPlay() void. I tried it with StartPlay() and I got an error, I think it’s the same error.
Never mind, thanks both of you, it works! I just had to build it a few times before my Visual Studio realised it was fine.
One thing is, I’m using GENERATED_UCLASS_BODY() in my header file yet Skynet, you used GENERATED_BODY(). What’s the difference? I don’t want to change my code to use GENERATED_BODY() yet incase it messes up again.
Finally, I can’t find any other FPS tutorials for Unreal Engine that are completely up-to-date. Does anyone know of any? I won’t ever be using UE4 below version 4.6 so there’s not much point of me knowing UE4 4.3 code.
GENERATED_UCLASS_BODY() is the old macro which is deprecated since version 4.6. When you use it you don’t need to declare your constructor in the header file but you always have to override the default constructor. In addition you use FPostConstructInitializeProperties.
GENERATED_BODY() is the newer version where you explicitly have to declare the constructor in the header file if you want to override it. In addition you use FObjectInitializer.