Category: Core How Tos

Actor Spawning and GetDefaultObject

actor_spawning_featured

Sometimes we need to spawn Actors in-game which are based on C++ classes. Moreover, we’re going to see what the function GetDefaultObject<T> does and why you should know about it! Let’s get started!

Actor Spawning

For this post, we will create two Actors. One will contain some dummy logic just for the sake of this post (let’s……


Casting types in Unreal Engine

actor_reference

Casting means that you can convert a type to another type. For example, you can convert a given Actor to a AStaticMeshActor in order to access a specific functionality of second one. To do this, you must make use of pointers. This post assumes you are familiar with pointers in c++, if that’s not the case,……


Understanding the Blueprint Function Library

bfl_h2

Sometimes, we want to create functions which are going to do useful stuff and we don’t care which blueprints can call them. We want these functions to be included in every blueprint in our project. Unreal Engine provides a very easy way to create such functions. Let’s see how we can create them!

Creating such functions

I……


Calling Blueprint Functions from C++

bps_to_cpp_bp2

In this tutorial, I’m going to show you how you can call functions (which are implemented in blueprints) in your C++ code. The steps required are the following:

Declare the corresponding function in C++
Implement the function in the Blueprint graph
Call the overrided function

Let’s start!

Declaring the Blueprint Function

The functions I am going to create is going to accept as……


Exposing C++ functions to Blueprints

func_declaration

In this tutorial I’m going to show you how you can expose a C++ function to Blueprints. As you will see, the workflow is almost identical in the one I used for variable exposing. Let’s start!

Exposing a C++ function using the corresponding Macro

In order to expose a function to Blueprints, I created a class named MyActor and……


Exposing C++ variables to Blueprints

macro-code

In this tutorial, I’m going to show you the required workflow in order to expose variables which were created in your code in the UE4 Editor. While this tutorial is dedicated to variables, the workflow is almost the same if you want to expose other aspects of your code. Even though this tutorial might seem quite……


Deleting a C++ Class

This workflow was taken from the UE4 answershub. In this tutorial you will find the steps required in order to delete a C++ class from your project.

Deleting a specific C++ Class

In order to delete a C++ class from your project follow the steps below:

Close Visual Studio
Close UE4 Editor
Remove the corresponding .cpp and .h file……


Adding a C++ Class

HeaderSource

In this tutorial I am going to

Show you how to add a C++ class (which will have no behavior at all – just for this tutorial).
Explain the difference between source and header files.
Show you how you can compile your code.

It doesn’t matter if your project is C++ or Blueprint based, the way to add a C++……