Book Image

Unreal Engine 4 Game Development Quick Start Guide

By : Rachel Cordone
Book Image

Unreal Engine 4 Game Development Quick Start Guide

By: Rachel Cordone

Overview of this book

Unreal Engine is a popular game engine used by developers for building high-end 2D and 3D games. This book is a practical guide designed to help you get started with Unreal Engine 4 and confidently develop interactive games. You’ll begin with a quick introduction to the Unreal Engine 4 (UE4) ecosystem. Next, you’ll learn how to create Blueprints and C++ code to define your game's functionality. As you progress, you’ll cover the core systems of UE4 such as Unreal Motion Graphics (UMG), Animation Blueprints, and behaviour trees to further build on your game development knowledge. The concluding chapters will then help you learn how to use replication to create multiplayer games. By the end of this book, you will be well-versed with UE4 and have developed the skills you need to use the framework for developing and deploying robust and intuitive games.
Table of Contents (10 chapters)

Using C++ variables in Blueprint

Now that both our C++ class and Blueprint subclass are set up, we can take a look at how they can interact. First up, let's add a variable in C++ that we can use in Blueprint.

In our MyActor.h file in Visual Studio, we can add variables as we normally would. Unreal has a few custom variable types, such as using an FString instead of a standard string, but for now we'll just use a float.

If we simply declared a float in our header file, it would not be accessible in Blueprints. For that, we need to use a special UE4 macro, UPROPERTY. Using this, we can specify where and how our variable can be used. Most commonly, variables exposed to Blueprint need to be accessible anywhere (class defaults, in the Blueprint code itself, and in the level instance properties), as well as be readable and writable.

Let's add a float called TestFloat...