Starting problems

Hello, I have problem. I beginner in Unreal Engine and I tried to do someting from this tutorial (https://docs.unrealengine.com/latest/INT/Programming/Tutorials/FirstPersonShooter/2/7/index.html). But there are many problems. I think it is because I have version 4.16 and this tutorial is for 4.15, but I don’t know. First problem was with “UCameraComponent” class. It wasn’t working. I had to include it. This is not problem, but in tutorial code is no including. Next problem was with “PlayerInputComponent”. the solution was same. My current problem is “GEngine” - not defined and this piece of code ( FPSCameraComponent->SetupAttachment(GetCapsuleComponent()):wink: It is not working for me, but in tutorial it is. Thanks for every help. :slight_smile:

Hi,

I’m not sure in which version, but recently some changes were introduced to make compiling faster, so yeah you need to include more headers yourself than in previous versions.

You have to include “Engine.h” to use GEngine, however, I never had to do that to use the SetupAttachment function. Where do you use it? Can you show us you code?

A tip for finding the required header for something: if you google for example “UE4 UCameraComponent” and open the docs page (https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Camera/UCameraComponent/index.html), by scrolling to the bottom you will find in which folder the header resides.

If you want to access GEngine, you can include just “Engine/Engine.h” instead of the ginormous monolithic header “Engine.h”.

Or if you have visual assist, just press alt+shift+s and start typing the name of what you want to use :smiley:

I didn’t know that it is enough to include “Engine/Engine.h”, thanks for sharing it! Also, I don’t use Visual Assist, so I was not aware of that possibility.

You should get visual assist then, it’s like 10 times better and 100 times faster than intellisense. Can’t imagine working with unreal without it anymore. :smiley:

Hello,

Thank you for you tips. I will include it. SetupAttachment function? I dont know what the fucntion does. I am learning everything from tutorials. There is the function used. My code is same as code in tutorial (https://docs.unrealengine.com/latest/INT/Programming/Tutorials/FirstPersonShooter/2/7/index.html). The problem with the function is parameter (GetCapsuleComponent()).
And I will get Visual Assist.


    // Create a first person camera component.
    FPSCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
    // Attach the camera component to our capsule component.
    FPSCameraComponent->SetupAttachment(GetCapsuleComponent());
    // Position the camera slightly above the eyes.
    FPSCameraComponent->SetRelativeLocation(FVector(0.0f, 0.0f, 50.0f + BaseEyeHeight));
    // Allow the pawn to control camera rotation.
    FPSCameraComponent->bUsePawnControlRotation = true;

check out my tut it’s in the signature