How to use async task in Unreal Engine

Unreal Engine has a useful feature called AsyncTask that allows you to execute code asynchronously via Task Graph system. It functions by running specific code on a specified thread and is primarily used when the task is too heavy to be executed instantly without blocking the game thread. AsyncTask(ENamedThreads::AnyThread, []() { // This code will run asynchronously, without freezing the game thread }); You can also create nested calls to asynchronous tasks, for example:...

July 31, 2022 · 2 min · Georgy Treshchev

How to create a multi-threaded for loop in Unreal Engine

Unreal Engine has different approaches to parallelize your code and one of them is ParallelFor. It is used when it is necessary to execute code multiple times with different number-based inputs, basically what a regular for loop does. But unlike a regular for loop that executes sequentially, ParallelFor runs on different threads, with possible different order of execution. Let’s say our task is to simply sum the values from the TArray<int32> array....

July 23, 2022 · 2 min · Georgy Treshchev

Reducing build size of Android or iOS game in Unreal Engine

There are multiple ways to reduce the build size. But on mobile platforms, this issue is most acute. I will show you how I managed to reduce the size of my Android game from 150MB to 50MB. Project settings There are many switches in the project settings that will help reduce the build size. The first thing you can do is set Build Configuration to Shipping and enable For distribution:...

June 12, 2022 · 3 min · Georgy Treshchev
An illustrative example with a comparison

How to integrate third-party library into Unreal Engine

Concept There are two main types of libraries: Static and Dynamic (also called Shared). A static library is statically linked to a program and is available at compile time. A dynamic (or shared) library, on the other hand, is dynamically linked and available at runtime. Static linking assumes that the library code is built into the final block of code, unlike dynamic linking. But the process of dynamic linking takes some time....

May 27, 2022 · 7 min · Georgy Treshchev