← Back to list

How to override engine classes of the Actors’ instances in levels without modifying the UE engine…

Sometimes you might want to override Unreal Level Actors’ classes like AStaticMeshActor, ASkeletalMeshActor, APlayerStart, and so on — to…

Urszula "Ula" Kustra in Towards Dev · 2024-01-30 01:42 · 61 claps · 2.8 min read
#unreal-engine #tutorial #programming #game-development #gamedev
Open on Medium ↗
Wiki topics: 💻 · Programming 🎮 · Gaming

How to override engine classes of the Actors’ instances in levels without modifying the Unreal Engine source code

Sometimes you might want to override Unreal Level Actors’ classes like [AStaticMeshActor](https://dev.epicgames.com/documentation/unreal-engine/API/Runtime/Engine/AStaticMeshActor), [ASkeletalMeshActor](https://dev.epicgames.com/documentation/unreal-engine/API/Runtime/Engine/ASkeletalMeshActor), [APlayerStart](https://dev.epicgames.com/documentation/unreal-engine/API/Runtime/Engine/APlayerStart), and so on — to either expand their functionalities or optimize their settings. But you cannot set their default classes in Project Settings, and modifying the engine’s source code with project-specific changes is not a good idea — that breaks the SOLID principles.

So, is it even possible?

Fortunately, yes. You can do that with Core Redirects.

**Core Redirects are one of the most important tools in terms of Unreal Engine programming — you should use them every time you change the names of any [UPROPERTY](https://benui.ca/unreal/uproperty/), [UFUNCTION](https://benui.ca/unreal/ufunction/), [UCLASS](https://benui.ca/unreal/uclass/), [USTRUCT](https://benui.ca/unreal/ustruct/), [UINTERFACE](https://benui.ca/unreal/uinterface/), or [UENUM](https://benui.ca/unreal/uenum-umeta/) — otherwise, their usages in Blueprints will break **(btw, Rider refactoring tools can generate Core Redirects automatically!).

In this example, I will use ClassRedirects to redirect the engine’s ASkeletaMeshActor class to my custom AMySkeletaMeshActor class in Actors’ instances in levels. [USkeletalMeshComponent](https://dev.epicgames.com/documentation/unreal-engine/API/Runtime/Engine/USkeletalMeshComponent) has various properties for skeletal mesh optimization, so we can apply them to every Skeletal Mesh Actor in every level.

‼️ATTENTION ‼️

You shouldn’t use this technique with BP classes because the size of the BP class can noticeably increase very easily because of how object references in BPs are handled. So, overriding engine classes of Level Actors with Blueprint classes might noticeably increase the loading times and have a bad impact on performance. You should use this technique with C++ classes only.

So let’s create the AMySkeletalMeshActor C++ class. Before we start, I suggest disabling the bAutomaticallyCompileNewClasses in Edit->Editor Preferences:

I suggest disabling those properties in Edit->Editor Preferences

I suggest disabling those properties in Edit->Editor Preferences

Now, let’s create a very simple class with some optimizations:

#pragma once

#include "CoreMinimal.h"
#include "Animation/SkeletalMeshActor.h"
#include "MySkeletalMeshActor.generated.h"

/**
 * 
 */
UCLASS()
class MYPROJECT_API AMySkeletalMeshActor : public ASkeletalMeshActor
{
 GENERATED_UCLASS_BODY()
};
#include "MySkeletalMeshActor.h"

AMySkeletalMeshActor::AMySkeletalMeshActor(const FObjectInitializer& ObjectInitializer)
 : Super(ObjectInitializer)
{
 // Enabling some optimization settings
 USkeletalMeshComponent* MeshComponent = GetSkeletalMeshComponent();
 MeshComponent->bEnableUpdateRateOptimizations = true;
 MeshComponent->bPerBoneMotionBlur = false;
}

After compiling the code, add this to your DefaultEngine.ini in the Config directory in your project:

[CoreRedirects]
+ClassRedirects=(OldName="/Script/Engine.SkeletalMeshActor",NewName="/Script/MyProject.MySkeletalMeshActor",InstanceOnly=true)

‼️Of course, you have to replace MyProject with the actual name of your project.‼️

I set InstanceOnly to true, because I want to redirect only Actors’ instances in levels, not the potential Blueprints that inherit from that class.

Now, after reopening your projects, Skeletal Mesh Actors’ instances should inherit from my custom class and have specific properties overridden:

That’s it! Extending the engine classes of Level Actors is that easy, and fortunately, it doesn’t require recompiling the whole source code 😌

References:

  1. Core Redirects in the UE Documentation
  2. Core Redirectors: What you need to know

Do you like my articles? Please consider supporting me. Thank you!


메타데이터
post_id
a11397a71bf7
slug
how-to-override-engine-classes-of-the-actors-instances-in-levels-without-modifying-the-ue-engine-a11397a71bf7
url
https://towardsdev.com/how-to-override-engine-classes-of-the-actors-instances-in-levels-without-modifying-the-ue-engine-a11397a71bf7
canonical_url
https://towardsdev.com/how-to-override-engine-classes-of-the-actors-instances-in-levels-without-modifying-the-ue-engine-a11397a71bf7
author_url
https://medium.com/@ukustra
status
ok
fetched_at
2026-06-16 19:09:56