UE5 Symbols Flashcards
UPROPERTY Macro
Definition:
Macro used to declare UObjects properties for reflection and editing.
Example:
UPROPERTY(EditAnywhere) int MyProperty;
UFUNCTION Macro
Definition:
Macro used to declare UObjects functions for Blueprint exposure and networking.
Example:
UFUNCTION(BlueprintCallable) void MyFunction();
UCLASS Macro
Definition:
Macro used to declare a new UObject-derived class.
Example:
UCLASS(Blueprintable) class MyActor : public AActor { /* … */ };
AActor Class
Definition:
The base class for all actors in Unreal Engine, providing functionality for placement in a level.
Key Functions:
BeginPlay(), Tick(), OnHit()
Constructor Helpers
Definition:
Special functions in C++ classes used to set up default values and initialize components.
Example:
MyActor::MyActor() { /* … */ }
Components
Definition:
Modular parts of an actor that can be added, modified, and interacted with.
Examples:
UStaticMeshComponent, UAudioComponent.
Delegates and Events
Definition:
Mechanisms for implementing callback functions and handling events in Unreal Engine.
Example: DECLARE_DYNAMIC_MULTICAST_DELEGATE(FMyDelegate);
GameMode Class
Definition:
Class defining the rules and gameplay for a specific game type.
Example:
class AMyGameMode : public AGameModeBase { /* … */ };
Collision Handling
Definition:
Managing interactions between objects in the game world.
Functions:
NotifyHit(), NotifyBeginOverlap(), NotifyEndOverlap
PlayerController
Definition:
Handles player input and manages the player’s viewport.
Functions:
SetupInputComponent(), Possess(), UnPossess().
AIController Class
Definition:
Handles the behavior of AI-controlled characters in the game.
Example:
class AMyAIController : public AAIController { /* … */ };
UE_LOG Macro
Definition:
Macro for logging messages to the output log in the editor.
Example:
UE_LOG(LogTemp, Warning, TEXT(“This is a warning message”));
BlueprintCallable Functions
Definition:
C++ functions marked to be accessible and callable from Blueprints.
Example:
UFUNCTION(BlueprintCallable) void MyFunction();
Function Overriding
Definition:
Replacing or extending the functionality of a base class function in a derived class.
Example:
virtual void BeginPlay() override;
Async Tasks
: :
This operator is known as the scope resolution operator. It is used to qualify names in namespaces, classes, and structures.
namespace MyNamespace {
int myVariable;
}
// Accessing the variable within the namespace //
int main() {
int value = MyNamespace::myVariable;
return 0;
}
class MyClass {
public:
int myMemberFunction();
};
// Accessing a member function of the class//
int MyClass::myMemberFunction() {
// Function implementation
return 42;
}
->
This operator is used to access a member of a pointer to an object. It is commonly used with pointers to access members of objects dynamically allocated on the heap or created with new.
// Assume we have a class definition like this://
class MyClass {
public:
int myVariable;
void MyFunction() {
// Function implementation//
}
};
// Create an instance of MyClass dynamically on the heap//
MyClass* myObject = new MyClass();
// Accessing a member variable using ->//
int variableValue = myObject->myVariable;
// Calling a member function using ->//
myObject->MyFunction();
// Don’t forget to free the memory when done//
delete myObject;
*
The * symbol is used for several purposes, primarily related to pointers and references.
- Pointer Declaration:
// Declare a pointer to an integer
int* MyPointer;
2. Pointer Dereferencing:
// Access the value pointed to by MyPointer
int value = *MyPointer;
3. Dynamic Memory Allocation:
// Allocate memory for an integer on the heap
int* dynamicInt = new int;
4. Pointer Arithmetic:
// Move the pointer to the next integer in an array
MyPointer++;
5. Reference Declaration:
// Declare a reference to an integer
int myVariable = 42;
int& MyReference = myVariable;
6. Function Return Type (Pointer):
// Function returning a pointer
int* MyFunction();
7. Wildcard Character (Unreal Engine Macro):
// Used as a wildcard character in UE4/UE5 macros
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = “MyCategory”)
int* MyVariable;
Namespace
A way to organize code and prevent naming conflicts. It provides a method for grouping related code elements, such as classes, functions, and variables, under a common name.
Here’s a basic example:
// MyNamespace.h
#pragma once
namespace MyNamespace {
class MyClass {
public:
void MyFunction();
}
int MyVariable; }
// MyNamespace.cpp
#include “MyNamespace.h”
void MyNamespace::MyClass::MyFunction() {
// Function implementation
}
In this example:
• MyNamespace is a namespace that encapsulates MyClass and MyVariable. • MyClass is a class defined within the MyNamespace namespace. • MyFunction is a member function of MyClass. • MyVariable is a variable declared within the MyNamespace namespace.