Unity Unreal



  1. Unity Vs Unreal Engine 4 Performance
  2. Unity Unreal
  3. Unity Unreal Engine 4
  1. Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
  2. Free download paid assets for Unity and Unreal Engine: 3D models, animations, weapons, blueprints, particles, shaders, templates, textures, tutorials and much more!
  3. Unreal Engine: licensing.Unreal Engine is generally better suited for high quality / performance applications -More advanced render features (ray tracing, sky atmosphere model, etc.) -Can easily be customized with C code.

Updated 1/23/2020. Unreal Engine 4 (UE4) and Unity are arguably two of the most popular game engines available to the public today. While many game development studios use their own proprietary game engines, there’s still a huge market for indie developers. Unity can get 'realistic' graphics, you just need to spend some time with the shaders. Afaik the graphic fidelity of unity and unreal are pretty much the same, the main difference is unreal come with post prossesing out of the box. And how is BP = Unreal Engine?

Let's rephrase here a fundamental question.

I'm considering using Unreal, but many people seem to be using Unity for making indie games. I'm never planning to go into AAA games, I only want to make indie games as a solo developer(maybe in a small team). Is Unreal the right choice for me? Does Unreal have significant disadvantages compared to Unity for an indie dev or a small team? Is it slower/harder to make prototypes and small indie games in Unreal? Why do so many people use Unity instead?

This is just a short summary which should give you some basic overview, so you would know better what to look at. It aims to clarify some doubts and myths.

Unity is great for 2D games, mobile games

  • Unity shines at mobile development, lightweight on phones. Small engine footprint, even now possible to embed the Unity app in another app.

  • Unity now supports every mobile monetization method possible (ads, in-app purchase) - they focused for years on it.

  • Unity is much better for 2D games. Unreal support is very limited, it has only Paper 2D plugin. Yes, a single plugin and nothing around in the engine is designed with 2D in mind. Even the orthographic camera doesn't fully work with Unreal's lightning. Meanwhile, Unity provides a lot: 2D lightning, animation tools, sprites, tilemaps. Read more about the evolution of 2D tools in Unity.

  • Lightweight mobile games is a major reason why there are more Unity games published than Unreal ones. There are over 4 million apps on App Store alone.

  • Unity is all about being 'simple, easy to start and universal'.

UE4 is designed for small teams

This is the myth that Unreal Engine is meant for large studios. It's essential to debunk it here.

UE4 was designed with indie teams in mind as Epic already filled 'AAA studio niche' as it was possible at a time. That's why we have blueprints, visual scripting and dozens of tools working with each other out of the box. Especially if somebody working on a game when gameplay uses characters or heavily-directed content (implementing and scripting small things in every place of the game instead of relying on programmer every day).

Unreal rendering focuses on physically based rendering and perspective camera. Making stylized games still possible, there are dozens of small stylized games done in UE4. You can make a racing game or spacecraft simulation game, the engine doesn't focus on FPS games (it's not UE3).

It comes with a lot of tools out of the box for handling characters, skeletal animations (not limited to humanoids), rendering such things as hair, fur and eye shaders. It's extremely indie-friendly in this regard.

It's already a tradition that Epic post a blog post with a list of stunning indie games developed with UE4 after major showcase events

Check examples of solo devs and small studios utilizing the engine - links to blog posts on the official blog.

And engine scales well from relatively small projects to AAA heavily modifying renderer.

How much engines cost?

  • Unreal Engine is now free to use. And you don't pay anything until you reach the first $1 million game revenue! Check FAQ with links to licensing terms.
  • Unity's personal license is free, but it comes with some limitations. Check their plans and pricing.

Tools & learning curve

  • Unity's easier to start with. It's much simpler, fewer systems and features than UE4, it's easier to comprehend. Although it's not easier for non-programmers who want to script anything, it doesn't come with visual scripting out of the box.

  • There's less learning of Unity since this engine doesn't provide reach gameplay framework out of the box. The built-in Unreal gameplay framework is used commonly to create games focusing on characters. First-person perspective, third-person view, but also top-down. It simply comes with character movement, character-oriented camera manager, advanced animation system.

  • This previous point doesn't matter much if your game doesn't utilize 3D characters. Or you prefer to establish your own gameplay framework from scratch - 'make engine your own'.

  • The issue can arise in Unity if you'd like to do implement a complex game. It's often harder with Unity if working solo or in a small team. Keep in mind, we're not talking about 'AAA complex level' - such division doesn't truly exist. There are no 'indie features' or 'AAA features'. Every project uses a different set of features. You might not need 90% of Unreal features, but you might need all complexity and flexibility of a single system, i.e. Sequencer - saving a lot of time and effort while working on animating things in your world.

  • Unreal provides AAA tools for many domains out of the box. It's relatively easy to work with PBR-based tools and achieve 'AAA indie' quality. The engine comes with visual scripting and many similar node-based editors. The list of tools and features provided with the vanilla engine is really long..

  • Skeletal animation system is extensive and provides a lot of tools to non-programmers. Working with animation is sweet, i.e UE4 is the common choice for fighting/action games. A new Control Rig system allows for procedural authoring animation just in the engine; also possible to keyframe animation through Sequencer and bake the result to animation asset. Learn how to create a character animation rig with Control Rig Mannequin sample.

  • There are no 'must-have' plugins for Unreal Engine to get from its marketplace. Engine plugins serve as workflow improvements or providing features for a specific type of project.

  • It makes UE4 very friendly for artists and designers. The engine philosophy is to provide all the standard tools out of the box. That's why it's so huge piece of software and it can be intimidating for beginners. You don't need to learn everything, just learn what you need for a given game. And you don't programmer to start since you got node-based editors everywhere in the engine.

  • Unreal Engine 5 promises to bring huge workflow updates to 3D artists. No more retopology of meshes, creating a low-poly version, generating LODs and baking normal maps.

  • Having so many systems and tools out of the box, sometimes you might feel forced to do things in the 'Unreal way'. That's sometimes some issue for developers/projects working on unconventional projects, or when doing things in a way designed by Epic engineer happens to be confusing.

  • Now, Unity is in process of adding fundamental tools to the vanilla engine, i.e. visual shader editor, input management. That's why the Asset Store was so vital for Unity through years as the engine was missing so many things. Still, there's no visual scripting - Unity acquired Bolt as a temporary solution, but their native solution isn't ready yet.

  • Unity's strength is flexibility in customizing rendering, how the render passes are arranged. It's improved with new Scriptable Rendering Pipelines - High Definition Render Pipeline and Universal Render Pipeline. This is much harder with UE, it's required to dive into C++ and modification of the engine code.

  • Nobody uses Unity's networking (they working on a brand new solution), relying on third-party solutions. Meanwhile, UE4 comes with the excellent multiplayer support out of the box. Unreal's gameplay framework is built with networking in mind. Gameplay Ability system is a specialized plugin preventing you from reinventing the wheel while building multiplayer mechanics.

Programming

Unity is friendly for programmers.

  • C# is easier to learn than C++, it feels mostly like a general-purpose scripting language in Unity.
  • If you don't get basics of programming yet, it might be very efficient to start learning programming for video games from Unity with C#. It would smoothly introduce you to coding and teach basic concepts. This might be recommended even if you plan to work with Unreal later - much easier to grasp Unreal C++ after that. And you would understand what you're doing in blueprints - sadly, official docs and many popular Youtube tutorials on blueprints don't explain programming concepts, so your blueprint code quickly gets messy.
  • Visual Studio works nicely with C# while editing C++ can be very cumbersome without proper plug-in (more below).
  • Both engines support Visual Studio Code, although that's rarely used for bigger games. In many ways, it's a supercharged Notepad.
  • Rider IDE supports Unity and C# for some time. Support for Unreal is coming, we have Preview for now.

People are often scared of learning C++ in UE4. It comes from the fact that pure C++ requires a lot of low-level knowledge, assembling your toolchain. The thing is you don't use pure C++ with UE4, the same way you don't use pure C# with Unity. Thanks to that writing C++ code for UE4 is much, much easier than regular C++. Actually, it's more similar to Unity's C#.

  • Epic built a multiplatform C++ library, tailored for game development. This is the engine's core. Something we often simply call 'Unreal C++'.
  • It provides low-level mechanisms (reflection, object handling with garbage collection) working under the hood. It brings the C++ environment closer to C# or scripting languages.
  • Unreal C++ provides its own libraries supporting math, vectors, strings (with support for text localization) and many other standard things. Just to make development easier, preventing game programmers from writing his own libraries for every single game.
  • Writing code is simplified, thanks to dozens of built-in class, function and property specifiers. Also macros and many utilities.

Be warned, Unreal C++ environment doesn't provide a perfect way to compile the project without ever closing the editor.

  • There's a mechanism called Hot Reload (triggered by a huge button in the editor toolbar) which allows rebuilding C++ code even if you changed code in the C++ header (.h file) or even added new classes. Unfortunately, it causes occasional data loss (apparently 4.26 will fix this issue, UE-52220).
  • However, Epic integrated Live++ to all developers since 4.22 - it allows you to safely recompile changes in .cpp files. It's quick and 100% stable. Even if the game is running! Super sweet, although limited only to .cpp files. It won't work with changes made to .h files.

If someone wants to be a programmer, shouldn't be much difference for them, C# or C++. Albeit learning curve for Unreal C++ is steep, partially because official docs don't explain programming/C++ concepts - assuming everybody is programmer already..

It's very important to begin a journey into the land of Unreal C++ with proper tools. C++ is punishing those who try to approach with bare hands.

  • It's very important to use plugins like Resharper C++ with Visual Studio. It's not the fault of Unreal, Visual Studio tools don't handle C++ well. Especially large codebases like game engines. It's standard for a C++ programmer to not rely on Intellisense tool provided with Visual Studio. Read more on efficient Setting up Visual Studio for Unreal Engine.
  • For those looking for an even better tool than Visual Studio, Rider for Unreal Engine is coming. And it's preview is already praised by many programmers. There won't be a free version, however.
  • One of the most annoying things that remain in Unreal C++ are compiler/linker error messages which aren't very clear, especially for beginners. Using tools like Resharper++ helps tremendously, it does properly highlight a lot of simple issues. Still, if you stuck at something, try asking questions online. Communities like Unreal Slackers are an amazing help. Just don't expect them to read your mind, explain your issue properly.

In theory, you could live without things below - especially if you've got only a single programmer in the team. However, this is essential for efficient work.

  • UE4 source code is available publicly, free of charge. You can download source code and debugging symbols through Epic Games Launcher. Engine stops begin a black box, you can truly understand how it works. It's not unusual to copy-paste small portion of engine code, often to quickly set up your own editor tool.
  • Set up some kind of 'build system' if having 2+ programmers - you need to compile C++ and then open editor, no magical compilation in the editor like in Unity. It's nothing difficult, it's great for non-programmers to obtain compiled binaries from the repository. And it makes easier to take advantage of the next sweet thing..
  • It's totally optional, but it's also common for Unreal teams. Ignoring pre-compiled engine available through the Epic Games Launcher and compiling engine from source. We call it a 'source build'. After that, you can easily alter small things in the engine - fix critical bugs, expose hidden things to the project, improve your tools and workflows.

Go ahead, check Introduction to Unreal C++ in official documentation :)

PS Epic purchased company behind SkookumScript for a reason. This a speculation, but they might come up with a custom scripting language designed to fill a gap between blueprints and C++. And that would serve us much better than just stitching another general-purpose language to the engine.

Stability of technology

  • Unity company doesn't create its own games. You can feel it this engine isn't used daily by the internal team working on complex games. Meanwhile Epic dog foods every single system. Either with Fortnite - systems and editor tools tested game played by hundreds of millions of people on every major platform. If Fortnite doesn't use specific systems, they build an extensive demo or small game (i.e. Robo Recall for VR). And this might the most important thing, Unreal tools are proven and often simply work. Even if marked as 'beta'.

  • It's important to note that many Unity developers recommend using LTS (Lont Term Support) releases of engine for production. Instead of so-called 'tech releases', which are introduced a lot of changes, new systems and tools - but often quite unstable for use in development.

  • Unity does usually create a promotional movie and doesn't even release it as a project - it's confirmed that some demos used renderer features that weren't implement in the engine afterward. For these reasons, we haven't ever seen a game that looks as good as Unity's internal demo. This is a weird strategy.

  • A lot of indie studios switch from Unity to UE4 for the next project because Unity wasn't enough for more ambitious projects: more content, higher visual fidelity, more power for non-programmers, easier prototyping. A notable example would be InXile switching to Unreal for the next RPG after Wastelands 3.

  • Unity is in process of upgrading the entire engine for bigger projects and teams, but this an enormous undertaking.. It's basically 'Unity 2nd generation', but changes are integrated into current Unity. It means the engine goes through huge architectural changes and some studios decide Unity is too unstable to develop 3D games for now. This is Reddit discussion under the opinion of Rust creator on the current state of Unity.

Unreal editor requires a better hardware

  • The Unity editor has low hardware requirements, but it won't run much faster on beefy hardware. It's great to make small games on a laptop, bring it to co-worker space or anywhere. Not so great for projects with a lot of code and assets, Unity won't scale that well.

  • UE4 requires more powerful hardware as it targets 3D games. It might get expensive if you're about developing the hi-end 3D game on a laptop. Check the article on Recommended Hardware for UE4. In return, the engine handles asset-heavy projects way better than Unity. As engine targeting AAA since the beginning of time - it's optimized for crunching gigabytes of content. Engine fully utilizes even 128 thread CPU for things like code compilation, shader compilation, cooking game. Now Epic is in process of upgrading engine for open worlds, that already brings performance and workflow benefits for smaller teams.

  • It's a huge productivity boost to use two screens with Unreal editor. It wasn't optimized to use on a single screen with resolution lower than Full HD.

For beginners

Youtube engine comparisons tend to overgeneralize, saying 'both engines have 3D tools, thus are similar'. And actually providing very little information, but.. this one is a really good comparison from the perspective of a beginner!

This guide provides an overview of UE4 from the viewpoint of a Unity user, and aims to help you translate your existing Unity experience into the world of UE4.

The Editor

Below are pictures of the Unity Editor and Unreal Editor, color-coded to indicate common functionality. Each block is labeled to show the equivalent UE4 terminology. Unreal Editor's layout is fully customizable by dragging and dropping tabs around.

Editing Assets

In Unity, the Inspector tab is used to edit selected assets in your Project. In UE4, the Details panel exposes properties of selected objects, while larger editing tasks lead to a dedicated window or tab. New tabbed windows will open for each edited asset, similar to a web browser. Of course, you can freely drag the tabs around or float them as standalone windows.

Quick Glossary

The following section contains common Unity terms on the left and their UE4 equivalents (or rough equivalent) on the right. UE4 keywords link directly to more in-depth information inside Unreal Engine's Online Documentation.

Content and Source sub-folders.

Where do I put my assets?

In UE4, each project has a Content folder. Similar to a Unity project's Assets folder, this is where your game assets are stored. To import assets into your game, simply drop files into your project's Content directory and they will be automatically imported and appear in the Content Browser. The assets in the editor will update automatically as you make changes to the files using an external program.

What common file formats are supported?

Unity supports a wide array of file formats. UE4 supports the most common file types:

Category

Unity

UE4

All project settings can be found from the main menu under Edit / Project Settings. Like Unity's project settings, these allow you to specify information about your project (such as project name and icons), configure game input bindings, and define how the engine behaves when running your project. You can learn more about individual project settings here. Unity also has what is called 'player settings'. In Unreal, these are 'platform settings', and can be found under the 'Platforms' category in your project settings.

Where do my source files go?

In Unity, you are accustomed to placing C# source files in your assets folder.

UE4 works differently. For projects that have C++ code, you will find a Source sub-folder under the project directory that has various files, including C++ source (.cpp) and header (.h) files, as well as some build scripts (.Build.cs, .Target.cs) However, Blueprint-only projects will not have a Source folder.

The easiest way to get started with C++ in UE4 is to use the editor to Add Code to Project (in the main File menu), or to simply create a new C++ project from scratch from one of the many templates. You can find C++ classes right in the Content Browser and can open the files in Visual Studio or Xcode by Double-clicking on their icons.

From GameObjects to Actors

Where is my GameObject?

In Unity, a GameObject is a 'thing' that can be placed in the world. The UE4 equivalent is an Actor. In the Unreal Editor, you can drag a new Empty Actor into the viewport from the Placement panel:

You could build a game out of Empty Actors, but UE4 also includes special types of Actors with built-in features, such as a Pawn (for players or AI objects), or Character (for animated creatures.) Just like Empty Actors, you can drop these special types of Actors down, then add or customize their properties and components. You will learn more about it later, but for now try to remember that UE4 has a Gameplay Framework that works with these special Actors.

Actors in UE4 are a bit different than GameObjects in Unity. In Unity, GameObject is C# class which you cannot directly extend. In UE4, Actor is a C++ class which you can extend and customize using inheritance. We will talk about this more later on!

Where are my components?

In Unity, you add components to a GameObject to give it functionality.

In UE4, you add components to Actors. After you have dropped an Empty Actor in your level, click the Add Component button (in the Details panel) and choose a component to add. Here, we are creating a torch by dropping an empty Actor, then adding a mesh component for the base, followed by a light source and then a particle system to create its flame.

In Unity, a GameObject hold a flat list of components, but in UE4 an Actor actually contains a Hierarchy of components attached to one another. You can see this in the example above, where the Light and Particle are attached to the Mesh. This has some important implications discussed later in Complex Actors and GameObjects.

From Unity Prefabs to UE4 Blueprint Classes

Unity's workflow is based on prefabs. In Unity you build a set of GameObjects with components, then create a prefab from them. You can then place instances of the prefab in your world, or instantiate them at runtime.

UE4's corresponding workflow is based on Blueprint Classes. In UE4, you build an Actor with components, select it, and click the Blueprint / Add Script button (in the Details panel). Then, choose a place to save your Blueprint Class, and click Create Blueprint to save your new Blueprint Class!

Your new Blueprint Classes can be found in the Content Browser. You can Double-click to edit them directly, or you can drag and drop them into any level.

Where are Script Component and MonoBehaviour?

In Unity, you have Script Components that you drop on GameObjects to add C# scripting. You create a class that inherits from MonoBehaviour to define what that component does.

UE4 has something similar. You can create whole new Component classes of your own and drop those onto any Actor. You can create Component classes using either Blueprint Scripting or C++.

So how do you create your own component class in UE4? In the Details panel's Add Component drop-down, you see you can create new components, or choose existing ones:

In Unity, when creating a new MonoBehaviour, you will be given a skeleton class file with a Start() function and an Update() function.

In UE4, you will also be given a skeleton class with a InitializeComponent() function and a TickComponent() function, which perform functions similar to Start and Update.

If you create a Blueprint Script Component you will be given these same functions as visual nodes:

Scriptable Actor Blueprint Classes

Here is a cool feature in UE4: Your new Actor Blueprint Class can have its own Blueprint Visual Scripting! This allows you to add logic to an entire object, not only an individual component. Combined with inheritance (explained below), this gives you a lot of flexibility when designing your game.

In addition to Blueprint Classes supporting visual scripting, UE4 also supports C++ Classes implemented with code. Here is a side-by-side comparison of Unity and UE4 code, followed by an equivalent UE4 Blueprint.

Asset Type

Supported Formats

Review

Unity C#

UE4 C++

UE4 Blueprint

UE4 Blueprint Classes Can Be Extended

Unity prefabs and UE4 Blueprint Classes can be instantiated in your game similarly. However, Unity has complications related to nesting prefabs within other prefabs, which limit their role as extensible building blocks.

In UE4, you can create a new Blueprint Class which extends an existing Blueprint Class and augments it with new properties, components, and visual scripting functionality.

For example, in UE4 you can create a Blueprint Class named Monster which implements basic monster functionality such as chasing people. You can then create further Blueprint Classes which extend it, such as Dragon (a type of Monster which adds fire-breathing features), Grue (a Monster which is likely to eat you when it is dark), and for example 8 others. These subclasses of Monster all inherit the basic functionality from Monster, and add new capabilities on top.

In Unity, you would implement this by creating many different GameObject prefabs: one for Dragon, one for Grue, and so on. Now, say you want to add some new functionality to all monsters, such as the ability to speak using your new Speak Component. In Unity, you have to go and update all 10 prefabs to individually copy and paste the new functionality into it.

In UE4, you can simply modify the Monster Blueprint Class to add this new ability to speak. That's all! Dragon, Grue, and the 8 other subclasses of Monster automatically inherit the new speaking functionality, and you do not need to touch them.

Microsoft for word mac os. But there is more! Everything we have said here about Blueprint Classes also applies to C++ Classes, and everything is equally true of Actors and Components. These systems are designed to support large-scale development of extensible functionality, and can scale to projects with 10's or 100's of developers.

Using Blueprint Scripting, C++, or Both

Blueprint Visual Scripting is ideal for simple in-game logic flow and sequencing of actions. It is a great system for designers, artists, and visually-oriented programmers, because it is easy to access and control in-game objects visually. You can even create small standalone-game using just Blueprints; see the Tappy Chicken sample for a full-fledged example.

C++ programming is for larger-scale tasks, such as building gameplay systems, complex AI, and new engine features. If you already have some C++ experience, check out the Introduction to C++ Programming in UE4 page.

Most projects will use a mix of Blueprints and C++. Many developers prototype game functionality using Blueprints, because it is so easy and fun, and later move some or all of it to C++ for performance and engineering rigor.

Blueprint Classes Can Extend C++ Classes

Much of the magic of UE4 game development comes from the interplay between programmers implementing new features in C++, with designers and artists utilizing them in Blueprints and then asking for more! Here's how a team might structure a UE4-based shooter game implementing pickups using a mix of C++ Classes systems programming, and Blueprint Classes for behavior and appearance:

Unity Vs Unreal Engine 4 Performance

Transform Components

In Unity each GameObject has a Transform component, which gives the GameObject a position, rotation, and scale in the world.

Similarly in UE4, Actors have a Root Component, which can be any subclass of Scene Component. A Scene Component gives the Actor a location, rotation, and scale in the world which is applied hierarchically to all components underneath it. Many of the components that you will use are subclassed from Scene Component, because it is really useful to have a position!

Even if you place an Empty Actor, UE4 will create a 'Default Scene Root' for that Actor, which is just a plain Scene Component. If you drop a new Scene component in of your own, it will replace the Default Scene Root.

Compound Objects

In Unity, you create compound objects by constructing a hierarchy of GameObjects and parenting their transforms together:

In UE4, you create compound game objects by nesting components hierarchically:

As you can see from the diagram, nested hierarchies can be created by attaching Scene Components to one another, since they have a transform - similar to parenting transforms in Unity. Actor Components (the base-class for all components) can only be attached directly to the Actor itself.

Do I build everything out of Components?

Its really up to you, but most often you will use a combination of custom component types along with Actor classes that use those components. We mentioned this earlier, but UE4 has many special types of Actors that guarantee a certain level of capability and always include certain components. For example, a Character always contains a Character Movement Component.

Unity Unreal

There are several sub-classed Actor types you will quickly encounter in the engine and are useful in almost every type of game. Here is a list of our most common built-in Actors:

  • Pawn - A type of Actor representing a controllable game object, typically the player's avatar. Pawns are moved by Players and AI alike through an owning Controller.

  • Character - A more specialized version of Pawn designed for biped avatars that handle a lot of the complexity of those kinds of game objects.

  • Controller - Possesses and controls a Pawn. By separating the Pawn from the controller, you can write AI Controllers that can manipulate a pawn using the same interface the player would.

  • Player Controller - A more specialized Controller designed for getting input from a player's Gamepad, Touch, or Mouse/Keyboard, and using that input to drive the Pawn or Character they possess.

So is everything an Actor?

Not everything. Actors are most common class used for gameplay in UE4 and the only type that can be Spawned into the World. So everything you place in your level will be an Actor.

The other important type to know about is Object. Object is actually the base class of all Unreal classes, including Actor and many others. This is a much lower-level construct than Actor, but still has features that you will expect from a Unreal class, such as Reflection and Serialization. Object is a very basic class we use when we need to define a new type that just does not fit the mold of an Actor. For example, Actor Component is the base class for all Components, and derives from Object instead of Actor.

What is this Gameplay Framework thing in UE4?

Okay, so this is where things get a little crazy (in sort of an awesome way.) Unity gives you a clean slate to start designing your game, and Unreal does the same. In Unity you can build everything out of basic GameObjects and components, and in Unreal you can build everything out of Actors and components.

However Unreal has this extra layer on top called the Gameplay Framework. This does not really exist in Unity at all. You do not have to use it in Unreal, but it is actually super cool! Basically, if you make use of some basic primitive classes and follow certain established conventions, your game will acquire some awesome features automatically that would be otherwise very difficult to implement or retrofit (such as full multiplayer support!)

Countless awesome games have been designed on top of Unreal's Gameplay Framework, and it is worth taking some time to understand how it works. Yes, you could roll your own version of this. That is totally fine if you want to! But hundreds of awesome Unreal developers have made great use of this framework in UE4 today, so it is worth taking some time to learn.

To use the Gameplay Framework, you really just need to learn the customized built-in Actor classes included with Unreal, such as Pawn, Character, and Player Controller, and eventually learn about how Unreal replication and networking features work. For now, let us get back to the basics though.

How to Write Code in UE4

For MonoDevelop Programmers

For Blueprint scripting, you will only need Unreal Editor -- everything is built in! To write code in C++, download the free version of Visual Studio on Windows, or install Xcode on Mac. When you first create a new project (or add code to an existing project), UE4 will automatically create Visual Studio project files for you. You can open Visual Studio by Double-clicking on a C++ class inside Content Browser, or by clicking the Open Visual Studio button in the main File menu.

One important difference in UE4: You will sometimes have to manually refresh your Visual Studio project files (for example, after downloading a new version of UE4, or when manually making changes to source file locations on disk.) You can do this by clicking Refresh Visual Studio Project in the main menu, or by Right-clicking on the .uproject file in your project's directory and selecting Generate Visual Studio project files.

Unity

Writing Event Functions (Start, Update, etc.)

If you are used to working with MonoBehaviors you are used to such methods as Start, Update, and OnDestroy. Here is a comparison between a Unity behavior and its counterpart in UE4 Actors and components.

In Unity, we might have a simple component that looks like this:

But remember, in UE4 you can write code right on the Actor itself rather than only coding new component types. This is actually very common and useful.

Similar to Unity's Start, OnDestroy, and Update functions, we have a similar set of methods for Actors in UE4:

C++ :

Blueprint :

Components in UE4 contain different functions. Here is a simple example:

C++ :

Blueprint :

Remember, in UE4 it is important to call the parent class' version of method.

For example, in Unity C# this would be called base.Update(), but in UE4 C++ we will use Super::TickComponent():

You may have noticed some things begin with 'A' and others with 'U' in C++. The prefix 'A' indicates an Actor sub-class. Where as the prefix 'U' indicates an Object sub-class. There are some other prefixes too, for example 'F' is used for most plain data structures or non-UObject classes.

Writing Gameplay Code in UE4

Okay, things are going to get a bit deeper from here on out. We will be talking about programming topics that are critical for creating games. Because you know Unity, we will be explaining features with slant toward C# users learning Unreal C++, but you can use Blueprint Scripting for pretty much everything if you want! We have added examples in both C++ and Blueprint where possible.

Let us talk about some of the most common gameplay programming patterns and how you would approach them in Unreal. Many functions in Unity have a comparable function in Unreal that should seem familiar. We will go through the most common functions one by one.

Instantiating GameObject / Spawning Actor

In Unity, we use the Instantiate function to create new instances of objects.

This function takes any UnityEngine.Object type (GameObject, MonoBehaviour, etc.), and makes a copy of it.

In UE4, there are a couple different functions to instantiate objects, depending on your needs. NewObject is used for creating new UObject types, and SpawnActor is used for spawning AActor types.

First we will briefly talk about UObjects and NewObject. Subclassing UObject in Unreal is much like subclassing ScriptableObject in Unity. They are useful for gameplay classes that do not need to spawn into the world or have attached components like Actors do.

In Unity, if you created your own subclass of ScriptableObject, you may instantiate it like this:

And in Unreal, if you created your own UObject derived type, you may instantiate it like this:

So what about Actors? Actors are spawned using the SpawnActor method on a World (UWorld in C++) object. How do you get the World object? Some UObjects provide a GetWorld method for you, as an example, all Actors do.

You will notice instead of passing in another Actor, we pass in the 'class' of the Actor we want to spawn. In our example, the class can be any subclass of AMyEnemy.

But what if you want to make a 'copy' of another object, like what Instantiate allows you to do?

The NewObject and SpawnActor functions can also be given a 'template' object to work with. Unreal will make a copy of that object, instead of making one 'from scratch'. This will copy over all of its UPROPERTYs and components.

You might be wondering what 'from scratch' means in this context. Each object class you create has a default template that contain default values for its properties and components. If you do not override these properties and do not provide your own template, Unreal will use these default values to construct your object. To help illustrate this, let us first look at a MonoBehaviour for example:

In the above example, we have an int property that defaults to 42, and a SphereCollider component that defaults to a radius of 20.

We can achieve the same thing in Unreal using the object's constructor.

In the constructor of AMyActor, we have set the default property values for the class. Note the use of the CreateDefaultSubobject function. We can use it to create components and assign default properties to them. All the subobjects we create using this function act as a default template, so we can modify them in a subclass or Blueprint.

Casting from One Type to Another

In this case, we get a component we know we have, then cast it to a specific type and conditionally do something.

Unity C#:

UE4 C++:

Destroying GameObject / Actor

Unity

C++

Blueprint

Finding GameObjects / Actors

Adding tags to GameObjects / Actors

Adding tags to MonoBehaviours / ActorComponents

Comparing tags on GameObjects / Actors and MonoBehaviours / ActorComponents

Physics: RigidBody vs. Primitive Component

In Unity to give any GameObject physics characteristics, you first give it a RigidBody component. In Unreal, any PrimitiveComponent (UPrimitiveComponent in C++) can be a physical object. Some common Primitive Components are ShapeComponents (Capsule, Sphere, Box), StaticMeshComponent, and SkeletalMeshComponent.

Unlike Unity which separates the responsibilities of collision and visualizations into separate components. Unreal combines the concepts of the potentially physical and the potentially visible into PrimitiveComponent. Any component that would have any geometry in the world, that could either be rendered or interacted with physically sub-classes from PrimitiveComponent.

Layers vs Channels

In Unity, they are called 'Layers'. UE4 uses Collision Channels, and they work in a similar way. You can read up on them here.

RayCast vs RayTrace

Unity C#:

UE4 C++:

UE4 Blueprint:

Click for full view.

Unity Unreal

Unreal

Triggers

Unity C#:

UE4 C++:

UE4 Blueprint:

You can read more about setting up collision responses here.

Kinematic Rigidbodies

Unity C#:

In UE4, The collision component and rigidbody component are one. The base class for this is UPrimitiveComponent, which has many subclasses (USphereComponent, UCapsuleComponent, etc.) to suit your needs.

UE4 C++:

Input events

Unity C#:

UE4 C++:

UE4 Blueprint:

This is what your input properties in your Project Settings might look like:

You can read more about how to set up input here.

FAQ

How do I load my last project automatically?

If you are used to Unity automatically loading the last project you were working on, the same is possible in UE4. To enable, check 'Always load last project on Startup' when opening a project. You can also toggle the setting at any time from the main Edit menu under Edit/Editor Preferences/Loading and Saving/Startup.

Where do I set Input Bindings for my game?

In Unity, you are used to using the Input Manager settings for Project to setup default bindings. In UE4 it works similarly. You will open your Project Settings then select the Input category. There, you can add various buttons (actions) and analog controls (axes). Give each control a name and default binding. Then, you can get callbacks to your game's Pawn when the input events are triggered. Check out the Input documentation page for the details.

How do I change the starting scene of my project?

You can change the startup map of your project from the project settings tab. From the main menu choose Edit/Project Settings->Maps & Modes to change the starting map.

How do I run my game?

The easiest way to run your game is to click the 'Play' button on the the main editor toolbar, which will run the game right inside the editor's process. If you want to run it as a standalone application, click the dropdown arrow next to 'Play' and choose 'Standalone Game'. Finally, if you want to run on a mobile device or in a web browser, you will use the 'Launch' button on the toolbar (after installing any prerequisites that are needed for that platform.)

What units are these?

In Unity, the primary unit of measurement is one meter. In UE4, the primary unit of measurement is one centimeter.

So if you move something 1 unit (meter) in unity that is equivalent to moving something 100 units (centimeters) in UE4.

If you want to move something 2 Feet in Unity that would be 0.61units (meter) and in UE4 is 61 units (centimeters).

What is with this coordinate system? Which way is up?

Both Unity and UE4 use a left-handed coordinate system, but the axes are swapped around. In UE4, positive X is 'forward', positive Y is 'right' and positive Z is 'up'.

Unity Unreal Engine 4

How do I see Log Output from my game?

In the UE4 editor, you can open the 'Output Log' from the 'Window -> Developer Tools' menu. You can also run your game with the '-log' command-line parameter to summon a dedicated log window alongside your game, which is really useful!

Speaking of Log Output, where is my Debug.Log?

Logging in UE4 is highly customizable. Read up on how to log messages here.

How do I throw exceptions?

In Unity, you are used to throwing exceptions when things go wrong. UE4 does not use exception handling. Instead, use the 'check()' function to trigger a critical assertion error. You can pass in an error message. If you want to report an error but not halt the program, use 'ensure()' instead. This will log an error with a full call stack, but program execution will continue. If you had a debugger attached, both functions will break into the debugger.

Where is the .NET Framework?

Unlike Unity, UE4 does not use the .NET framework. UE4 has its own set of container classes and libraries. Common container comparisons:

Unity

C++

Blueprint

Unity

C++

Blueprint

Unity

C++

Blueprint

Unity

C++

Blueprint

Compile button on the editor's main toolbar. That can be useful when you have the Visual Studio debugger attached.

Where To Go From Here

Thanks for reading the guide! This was created for the Unreal community with the help of Unreal developers everywhere, and we very much appreciate any feedback and corrections you can offer. We will try to keep improving this document as we learn more about what is most helpful when transitioning to UE4!

We have many additional UE4 learning resources available!

  • Documentation

    • Getting Started - Basics/GettingStarted

  • Tutorial Videos - Videos

  • API - API

  • AnswerHub - https://answers.unrealengine.com

  • Forums - https://forums.unrealengine.com

  • Wiki - https://wiki.unrealengine.com

    • Wiki page about learning UE4 coming from Unity

.Net Framework

UE4