Hi,
I’m following the unreal tutorial to make a fps game in c++.
At this point https://docs.unrealengine.com/latest/INT/Programming/Tutorials/FirstPersonShooter/2/7/index.html i got problem after compiling.
If it can be useful this is the .h and .cpp codes: FPS Tutorial codes - Pastebin.com
I’m using the Unreal Engine 4.16 and Visual Studio 2017
Thanks and sorry for my bad english
This is my guess:
In your Character .h file,
Change:
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "FPSCharacter.generated.h"
to:
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Camera/CameraComponent.h"
#include "FPSCharacter.generated.h"
If this doesn’t, post the problem you have compiling.
Azoresst
(Azoresst)
June 25, 2017, 4:18pm
3
Hello,
Sorry for digging up this thread but I’ve the same problem and I already put on my Character .h file the "#include “Camera/CameraComponent.h” and I got this errors:
Thanks!
Neongho
(Neongho)
June 26, 2017, 7:42am
4
YHey maybe the tutorial on my signature can be usefule here
That error has nothing to do with the CameraComponent.h include. As the error says, you cannot convert a “UCapsuleComponent” to a “USceneComponent” in the SetupAttachment function.
Are you following the same FPS tutorial?
If so, you might want to try:
FPSCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
FPSCameraComponent->SetupAttachment();