January 18, 2020

published by: Yonseo

First time using Unreal Engine

Like most things to get started using a library or a software you read the documentation. Here's a link of what I'm going to be covering.


Here's a link to the project files for this tutorial.


no image found

What are Actors?

First thing to know about Unreal Game Engine is that Actors are objects in a scene. Objects can be anything from a light post, a bear, a person, a chair, etc. You can attach scripts to Actors.

For example, if I have a box in a scene it will do nothing but appear on the screen. To give it a function or something to do we can code a script and attach that script to the Actor.

This is how objects interact and function in a scene. Like actors in a film, except we use objects and in game engines objects can be anything we create.

What is Spawning?

When an object spawns onto the scene it means it will appear from no where and render instantaneously. Because we are working in a Game Engine we can place objects anywhere. This is where they will spawn. We can control where and when objects spawn by either moving them into the desired location or coding a script and attaching it to the Actor object.

Visual Studio IDE

To develop games in Unreal Engine you need an IDE (integrated development environment) where you can type and compile code.

There are two code editors, one is Visual Studio(for Unreal Engine Development) the other is Visual Studio Code(general purpose code editor). I'm using Visual Studio Community edition.

You can download Visual Studio here: https://visualstudio.microsoft.com/

To confugure Visual Studio to work better for Unreal Game Development: https://docs.unrealengine.com/en-US/Programming/Development/VisualStudioSetup/index.html

no image found

Opening projects with Visual Studio

I created a project with a parent class Actor and named it MyProject (project names cannot contain any spaces). This will create the Actor class for me and launch Visual Studio.

You will see this message below appear at the bottom right of your Game Engine window.

no image found

If Visual Studio does not open automatically then refresh your project as shown in the picture below. This option is to sync Unreal Engine to your project in Visual Studio. It's important to refresh your project when changes are made or when you first open Unreal Engine.

no image found

If you don't see "Refresh Visual Studio" or "Open Visual Studio" options then go to Edit > Editor Preferences > General> Source Code.

no image found

From here you can select the default editor you want your project to open with. I'm using Visual Studio 2019. Click Set as Default. You may need to restart Unreal Engine to save changes.

no image found

Now you can open your project with Visual Studio through the file menu. Remember if you're having problems with opening Visual Studio with Unreal Engine you need to refresh your project first.

no image found

Working with C++ Scripts

Your project directory should look something like this.

no image found

I've copied and pasted the code provided into the actor c++ script which you can see below. At this moment I'm working with c++ code but I am not programming. Later, I will go over programming in c++ to change some things about our cube.

no image found

The actor header script.

no image found

We have two files, one is .cpp (c++ file) and the other a .h (header file). A header file is like an index in a book where you can check what topics/subtopics are on what page. The difference here is that we can access the index and specific data without turning the page because the header file is included on line 4 in my FloatingActor.cpp script by using the tag #include.

Building and Compiling Code

You can build your project by right clicking and selecting build. It's important to save before you attempt a build.

no image found

Alternatively you can build in Unreal Engine by clicking the Compile button in the toolbar. Always save your work before you attempt to Compile.

no image found

What is a Static Mesh?

A mesh is a 3 dimensional polygonal object that is connected by vertices. The faces that fill the vertices are called polygons. The vertices of an object CAN be animated but if static it can NOT be animated therefore making it a static mesh. Static meshes can be scaled, moved, or reskinned in realtime making it an editable object.

Working in Unreal Editor

Last edit 1:52pm Jan.21

To open your project folder in Unreal Engine click on the folder icon shown in the image. This will display a pop up and under C++ Classes you will find your project folder.

no image found

no image found

You should see an object named FloatingActor. Drag and drop FloatingActor onto the 3D window. This will create an instance of the FloatingActor object and rename it to FloatingActor1.

What is an Instance?

An instance is a copy of an object that retains all of that objects properties.

We can think of this as a grain of rice. There is white rice, brown rice, short grain, medium grain. There are multiple of the same type of object which retain the same qualities of that one type of object. If we wanted to change white rice to brown rice I would only need to change the objects property (in this case the color property) to a brown color. By changing this one objects property all other instances will change to be the same as the original object.

It's important to know that the original object is not used in game but rather instanced to create duplicate objects. You will see that when the FloatingActor object is dropped onto the 3D window it is renamed to FloatingActor1. This is how instances are used in Game Development.

Press Play

Press the play button and watch the cube spin as it floats up and down. This is all done by the script that is attached to the object. On the next post we'll look at how to edit c++ scripts to change the objects function.

no image found

#videogame #gamedev #unreal

Last edit: 2020-02-01