Here we use the following code as an example for analysis. It may change in later versions of Unreal but will be similar. FORCEINLINE void AddSharedReference() { SharedReferenceCount.FetchAdd(1, EMemoryOrder::Relaxed); } void ReleaseSharedReference() { RefCounter::ValueType OldSharedReferenceCount = SharedReferenceCount.FetchSub(1,
Catalog: Unreal Engine
Here are some notes on the speech given by the Technical Director of China Region.
The problem is using UE4.23 (the last version that supports the HTML5 platform) to package HTML5 and deploy it to the Apache server. After the basic settings are completed, an error occurs. The page error is as follows. Uncaught TypeError: Cannot read properties of null (reading 'toLowerCase') Uncaught TypeError: Cannot read properties of null (reading 'toLowerCase') U
Resource Common resource type prefix suffix Level / Map Level (Persistent) _P Level (Audio) _Audio Level (Lighting) _Lighting Level (Geometry) _Geo Level (Gameplay) _Gameplay Blueprint BP_ Material M_ Static Mesh SM_ Skeletal Mesh SK_ Texture T_ _* Particle System PS_ Widget B
The problem is well known and UE's HTML5 platform displays it by default as follows. There are several problems with this. Canvas only displays in the middle. There are extra buttons below. The solution is to set Canvas to adaptive resolution. Set Project Settings > Platforms > HTML5 > Canvas Scaling Mode to Stretch. Set the Canvas Wrapper to adaptive resolution. Modify the following paragraph in the .css file. .wrapper { position: relative; ma
When Unreal Engine is packaged, the BootstrapPackagedGame startup EXE file will be created in the root directory and the real UE64 game EXE file will be placed in Binaries/Win4. It is created through the following process: Copy the Engine/Binaries/[Platform]/BootstrapPackagedGame-[Platform]-Shipping.exe file to the root directory Update Build/Windows/Application.ico Update the icon Update the game EXE file to be executed Relative path parameters Update the game Basic parameters of BootstrapPacka
class FTestTask { public: FTestTask(const FString& InTaskName) : TaskName(InTaskName) { } TStatId GetStatId() { RETURN_QUICK_DECLARE_CYCLE_STAT(TestTask, STATGROUP_TaskGraphTasks); } ENamedThreads::Type GetDesiredThread() { return ENamedThreads::
As we all know, UE does not provide a common container for priority queues. But there are some heap functions in TArray that can implement priority queue operations. A simple encapsulation is provided here, in which the smaller the Priority value, the higher the priority. template class TRFurPriorityQueue { public: FORCEINLINE TRFurPriorityQueue() = default;
Engine: UE4.26.2 build version The cause of the problem is that when writing the voxel builder, I wanted to generate a ball, so I thought of copying the SphereMask node of the material. Here we take the SphereMask node as an example to analyze the definition of the material blueprint node. The C++ parent class of UMaterialExpression material node is UMaterialExpression, which is defined in the MaterialExpression.h header file. All native material nodes are subclasses of this class. The main members of this class are as follows. virtual int32 Compile(class FMaterialCompil
The problem is that after upgrading from UE4.24 to UE4.26, I want to package Android. I delete the previous NDK and then install the new NDK according to the instructions on the official website. When packaging, it prompts that the packaging fails. The key content of the Log is as follows. UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): ====2021-08-09 14:35:59====PERFORMING FINAL APK PACKAGE OPERATION=====-armv7==== ================================
Suppose we have a structure with the USTRUCT macro, and we want to be able to make or break in our own way in the blueprint. This requirement is usually because we use members in the structure that do not support reflection in C++. USTRUCT(BlueprintType, Meta = (HasNativeMake, HasNativeBreak)) struct FMeshVertex { GENERATED_BODY() UPROPERTY(EditAnywhere) FVector Position; UPROPERTY(EditAnyw
Lengyel-VoxelTerrain.pdf
ParallelFor is UE's built-in For loop that supports multi-threaded parallel processing tasks and is quite commonly used in rendering systems. Calling method function signature void ParallelFor(int32 Num, TFunctionRef Body, bool bForceSingleThread, bool bPumpRenderingThread = false); void ParallelFor(int32 Num, TFunctionRef
UFUNCTION() virtual void FunctionName(…) PURE_VIRTUAL(ClassName::FunctionName, … );
Engine: UE4.26.2 build version StaticMesh, referred to as SM, represents the static mesh in the engine. In the new version of the engine, SM is also allowed to be built at runtime. Rendering an SM requires the support of SMC. SMC uses static/dynamic rendering. Path, static rendering paths will be used first if allowed, and all rendering commands will be cached. Class diagram UStaticMesh Class diagram classDiagram IInterface_AssetUserData <|.. UStaticMesh Interface_CollisionDataProvider
Engine: UE4.26.2 build version ProceduralMeshComponent, referred to as PMC, provides a procedural mesh component that can make renderable meshes through custom triangles, uses dynamic rendering paths, and collects rendering data at each frame without any data caching. Class Structure Game Class Diagram classDiagram Interface_CollisionDataProvider <|.. UProceduralMeshComponent FPrimitiveSceneProxy <|– FProceduralMeshScenePro
As we all know, UE4 prohibits RTTI, which results in incomplete support for dynamic_cast, which means that conversion from base class to subclass is not supported. However, when reading the TSoftObjectPtr (SoftObjectPtr.h) code, I saw: /** * Dereference the soft pointer. * * @return nullptr if this object is gone or the lazy pointer was null, otherwise a valid UObject point
Start logging status to file stat startfile Stop logging status to file stat stopfile Convenient scope timer can be used directly QUICK_SCOPE_CYCLE_COUNTER(STAT_ClassName_FunctionName); Declare status group DECLARE_STATS_GROUP(TEXT("Group Name"), STATGROUP_GroupName, STATCAT_Advanced); Declare counter DECLARE_DWORD_ACCUMULATOR_S
Results engine version 4.26.2 implements a UTexture2DArray wrapper. Supports texture array creation and modification at Runtime. Supports texture array MipMap (the official implementation only has layer 0 Mip). The rendering shows that this texture array has a total of 5 elements and 5 Mip levels. Among them, the horizontal direction is the element, and the vertical direction is the Mip level. CodeTexture2DArrayWrapper.h #pragma once #include "CoreMinimal.h" #include "UObject/Object.h&q
N North X+ S South X- E East Y+ W West Y- T Up Z+ B Down Z-
Performance Assertion failed: !FPaths::IsRelative(Dir) [File:/Engine/Source/Runtime/Projects/Private/ProjectDescriptor.cpp] [Line: 337] ../../../UGCExample/../RemappedPlugins / is not an absolute path. The solution is to modify line 143 of ProjectDescriptor.cpp: // If this is a pa
void AsyncTask(ENamedThreads::Type Thread, TUniqueFunction Function); General task thread: ENamedThreads::AnyHiPriThreadNormalTask General callback thread: ENamedThreads::GameThread
PRAGMA_DISABLE_OPTIMIZATION // Code PRAGMA_ENABLE_OPTIMIZATION
Original portal FRunnable & FRunnableThread FRunnable provides the most primitive thread support, similar to std::Thread, although not as elegant, but has slightly more functions than std::Thread FRunnable - carries business logic + [f] Init: initialization, can Failure+[f] Run: The thread runs the function and returns the exit code+[f] Stop: Terminates the thread early+[f] Exit: Cleans up before exit+[f] GetSingleThreadInterface: The platform does not support it
Hard get UObjectLibrary* ObjectLibrary = UObjectLibrary::CreateLibrary(UUserDefinedStruct::StaticClass(), false, GIsEditor); ObjectLibrary->LoadAssetDataFromPath(TEXT("/Game")); TArray AssetDatas; ObjectLibrary->GetAssetD
r.VolumetricFog.GridPixelSize Volume fog pixel size r.VolumetricFog.GridSizeZ Volume fog Z depth r.VolumetricFog.TemporalReprojection Time effect accumulation r.VolumetricFog.HistoryWeight Time effect accumulation length [frame] r.VolumetricFog.Jitter Jitter accumulation