Skip to content

Instantly share code, notes, and snippets.

@R3D9477
Last active February 17, 2021 08:44
Show Gist options
  • Save R3D9477/8f54c15d225378b390dc7125fc33ea13 to your computer and use it in GitHub Desktop.
Save R3D9477/8f54c15d225378b390dc7125fc33ea13 to your computer and use it in GitHub Desktop.
Unreal Engine 4 C++ QtCretator short instruction
1) install qtcreator
2) install qt + desktop compilers
2) create new ue4 project (don't use white spaces in the path to project!!!)
3) add new C++ class
4) open QtCreator
5) QtCreator -> Open Project -> <path_to_ue4_project> -> [project].pro
6) QtCreator -> Projects
7) Select Desktop Qt... [double click]
8) Build -> Build Settings: Edit Build configuration = Debug
Build Steps: remove qmake
Build Steps -> Make -> Details -> Make Arguments = UE4Editor-Linux-Debug
Clean Steps -> Make -> Details -> Make Arguments = UE4Editor-Linux-Debug ARGS="-clean"
General -> Shadow Build [ ] (disabled)
9) Build -> Build Settings: Edit Build configuration = Release
Build Steps: remove qmake
Build Steps -> Make -> Details -> Make Arguments = UE4Editor
Clean Steps -> Make -> Details -> Make Arguments = UE4Editor ARGS="-clean"
General -> Shadow Build [ ] (disabled)
10) Run -> Run
-> Executable = ...[FULL_PATH_TO_UE4Editor].../Engine/Binaries/Linux/UE4Editor
-> Command line arguments = ...[FULL_PATH_TO_UE4_PROJECT]....uproject
-> Working Directory = [EMPTY]
11) Run -> Run -> Debugger Settings -> Enable QML [ ] (disabled)
1) UE4Editor -> Content Browser -> Add New C++ Class -> Pawn
2) Open *.pro file in C++ IDE
3) There are needed code by UE4 Reflection System:
#include "TypeName.generated.h"
UCLASS()
GENERATED_BODY()
4) Add StaticMesh, SprintArm, Camera to Pawn (into BasePlayer.h):
(header) add includes:
#include "Components/StaticMeshComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "Camera/CameraComponent.h"
( should be before line #include "BasePlayer.generated.h" )
(header) add variables into class:
// https://docs.unrealengine.com/en-US/ProgrammingAndScripting/GameplayArchitecture/Properties/index.html
UPROPERTY(VisibleAnywhere, BlueprintReadOnly) // make variable visible in for UE4 Reflection System
UStaticMeshComponent* Mesh;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly) // make variable visible in for UE4 Reflection System
USpringArmComponent* SpringArm;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly) // make variable visible in for UE4 Reflection System
UCameraComponent* Camera;
(source) class constructor:
// initaalize variables
Mesh = CreateDefaultSubobject<UStaticMeshComponent>("Mesh");
SpringArm = CreateDefaultSubobject<USpringArmComponent>("SpringArm");
Camera = CreateDefaultSubobject<UCameraComponent>("Camera");
// set hierarhy of components
RootComponent = Mesh;
SpringArm->SetupAttachment(Mesh);
Camera->SetupAttachment(SpringArm);
5) Run Release or Debug
6) recompile and reload C++ code in UE4 (button in toolbar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment