# \#constructors

**URL:** https://forums.unrealengine.com/tag/constructors/8650.md

[Latest](https://forums.unrealengine.com/latest.md) · [Categories](https://forums.unrealengine.com/categories.md) · [Tags](https://forums.unrealengine.com/tags.md)

---

## [How to write constructor for custom struct](https://forums.unrealengine.com/t/how-to-write-constructor-for-custom-struct/341749)

<div class="topic-metadata">

**Author:** [@SiberianExpress](https://forums.unrealengine.com/u/SiberianExpress)\
**Replies:** 3\
**Last updated:** [September 22, 2026, 9:03am UTC](https://forums.unrealengine.com/t/how-to-write-constructor-for-custom-struct/341749 "2026-09-22T09:03:57Z")

</div>

I created a custom struct “FIntVector2D” simply a 2D integer vector using the FIntVector template. file ObjectLib.h \> #include "Engine/ObjectLibrary.h" \> #include "ObjectLib.generated.h" \> \> USTRUCT(im…

---

## [Enum to name is Broken](https://forums.unrealengine.com/t/enum-to-name-is-broken/330052)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_fbe5155f](https://forums.unrealengine.com/u/anonymous_user_fbe5155f)\
**Replies:** 40\
**Last updated:** [February 10, 2026, 3:54pm UTC](https://forums.unrealengine.com/t/enum-to-name-is-broken/330052 "2026-02-10T15:54:49Z")

</div>

In a Constructor - this won’t work: Drag out of enum, pass to Get Data Table Row (Row Name) Observe: a Enum to Name converter will be automatically inserted. Expected: the row name to get the friendly name of the Enu…

---

## [Grid system in construction phase ](https://forums.unrealengine.com/t/grid-system-in-construction-phase/2602123)

<div class="topic-metadata">

**Author:** [@chinoFmoreno](https://forums.unrealengine.com/u/chinoFmoreno)\
**Replies:** 5\
**Last updated:** [July 14, 2025, 4:19am UTC](https://forums.unrealengine.com/t/grid-system-in-construction-phase/2602123 "2025-07-14T04:19:40Z")

</div>

Hi! I need an advice on how to make grid system in construction phase (or any other system where i need a bunch of “Actors” or “Actor-like” objects proceduraly spawned). Lets say i need a grid with cells like in mineswe…

---

## [Set Static Mesh by UProperty Ref via Constructor (C++)](https://forums.unrealengine.com/t/set-static-mesh-by-uproperty-ref-via-constructor-c/2079530)

<div class="topic-metadata">

**Author:** [@LowResDev](https://forums.unrealengine.com/u/LowResDev)\
**Replies:** 2\
**Last updated:** [October 22, 2024, 9:27pm UTC](https://forums.unrealengine.com/t/set-static-mesh-by-uproperty-ref-via-constructor-c/2079530 "2024-10-22T21:27:00Z")

</div>

I would like to set the Static Mesh of a Static Mesh Component by referencing a UStaticMesh property via the constructor in C++. It works via BeginPlay, Tick, and the constructor via Blueprints, but not the constructo…

---

## [CreateDefaultSubobject with SubClassOf](https://forums.unrealengine.com/t/createdefaultsubobject-with-subclassof/2020878)

<div class="topic-metadata">

**Author:** [@AreYouTheBot020](https://forums.unrealengine.com/u/AreYouTheBot020)\
**Replies:** 2\
**Last updated:** [September 14, 2024, 6:01pm UTC](https://forums.unrealengine.com/t/createdefaultsubobject-with-subclassof/2020878 "2024-09-14T18:01:10Z")

</div>

I have a UMyActorComp : UActorComponent that I am finding I need to do stuff with as a Blueprint, I should only need 1 Blueprint Type, and “shouldn’t” need to derive further. currently I have UPROPERTY(EditAnywhere, Bl…

---

## [Mesh access in constructor](https://forums.unrealengine.com/t/mesh-access-in-constructor/1888232)

<div class="topic-metadata">

**Author:** [@BugSwat](https://forums.unrealengine.com/u/BugSwat)\
**Replies:** 0\
**Last updated:** [June 4, 2024, 12:14am UTC](https://forums.unrealengine.com/t/mesh-access-in-constructor/1888232 "2024-06-04T00:14:41Z")

</div>

You shall avoid asset references in your c++ code! If the needed mesh is set in a member variable and set in the editor, it is not accessible in the constructor, but in BeginPlay. If the constructor does not add anythin…

---

## [Object created with "CreateDefaultSubobject" null after copying blueprint asset in editor](https://forums.unrealengine.com/t/object-created-with-createdefaultsubobject-null-after-copying-blueprint-asset-in-editor/1711587)

<div class="topic-metadata">

**Author:** [@Joost](https://forums.unrealengine.com/u/Joost)\
**Replies:** 1\
**Last updated:** [February 25, 2024, 1:29pm UTC](https://forums.unrealengine.com/t/object-created-with-createdefaultsubobject-null-after-copying-blueprint-asset-in-editor/1711587 "2024-02-25T13:29:13Z")

</div>

I have an AttributeSet object that gets created in my character’s constructor. If I duplicate a child blueprint asset, the AttributeSet is always null in the copy. If I rename the variable and rebuild my project that fi…

---

## [\[Feature Request\] Add constructor for Blueprints derived from Object class](https://forums.unrealengine.com/t/feature-request-add-constructor-for-blueprints-derived-from-object-class/354983)

<div class="topic-metadata">

**Author:** [@romadoma](https://forums.unrealengine.com/u/romadoma)\
**Replies:** 4\
**Last updated:** [December 17, 2023, 1:25pm UTC](https://forums.unrealengine.com/t/feature-request-add-constructor-for-blueprints-derived-from-object-class/354983 "2023-12-17T13:25:26Z")

</div>

Hi! I’m using a blueprints derived from Object type for creating code-only (logic-only) blueprints (without Viewport tab.) Look to picture below to understand what I mean. Step 1: Creation of blueprint derived from Obj…

---

## [UObject is still nullptr after being initialized in constructor](https://forums.unrealengine.com/t/uobject-is-still-nullptr-after-being-initialized-in-constructor/1406133)

<div class="topic-metadata">

**Author:** [@shue\_it](https://forums.unrealengine.com/u/shue_it)\
**Replies:** 2\
**Last updated:** [November 20, 2023, 3:36pm UTC](https://forums.unrealengine.com/t/uobject-is-still-nullptr-after-being-initialized-in-constructor/1406133 "2023-11-20T15:36:08Z")

</div>

Hello o/ I have two C++ classes (let say A and B class) which inherit from the same C++ parent class (let say AZ), which contains a custom Data variable (UMyData, which just inherit from UObject) In each constructor of…

---

## [\[Bug\] \[FBodyInstance\] \[UInstancedStaticMeshComponent\] Potential bug in FBodyInstance when using UInstancedStaticMeshComponent](https://forums.unrealengine.com/t/bug-fbodyinstance-uinstancedstaticmeshcomponent-potential-bug-in-fbodyinstance-when-using-uinstancedstaticmeshcomponent/1371370)

<div class="topic-metadata">

**Author:** [@argingras2](https://forums.unrealengine.com/u/argingras2)\
**Replies:** 0\
**Last updated:** [November 7, 2023, 5:52pm UTC](https://forums.unrealengine.com/t/bug-fbodyinstance-uinstancedstaticmeshcomponent-potential-bug-in-fbodyinstance-when-using-uinstancedstaticmeshcomponent/1371370 "2023-11-07T17:52:30Z")

</div>

Issue: In FBodyInstance::SetCollisionEnabled, if the value of FBodyInstance::CollisionEnabled actually changed since its last call, the function UActorComponent::RecreatePhysicsState gets called. In turn, that function …

---

## [Providing construction time critical state to a parent from the Child](https://forums.unrealengine.com/t/providing-construction-time-critical-state-to-a-parent-from-the-child/1310455)

<div class="topic-metadata">

**Author:** [@berriers](https://forums.unrealengine.com/u/berriers)\
**Replies:** 1\
**Last updated:** [September 24, 2023, 7:42pm UTC](https://forums.unrealengine.com/t/providing-construction-time-critical-state-to-a-parent-from-the-child/1310455 "2023-09-24T19:42:49Z")

</div>

There’s a fairly common pattern in C++ that I cannot figure out how to implement when my class is a UObject. Let me describe the pattern first (I don’t think it has a name): The parent has a critical piece of state th…

---

## [ConstructorHelpers in UE5.1.1 make the project unable to run packaged (black screen)](https://forums.unrealengine.com/t/constructorhelpers-in-ue5-1-1-make-the-project-unable-to-run-packaged-black-screen/765991)

<div class="topic-metadata">

**Author:** [@Aherys](https://forums.unrealengine.com/u/Aherys)\
**Replies:** 2\
**Last updated:** [July 26, 2023, 3:27pm UTC](https://forums.unrealengine.com/t/constructorhelpers-in-ue5-1-1-make-the-project-unable-to-run-packaged-black-screen/765991 "2023-07-26T15:27:44Z")

</div>

Hello, I just migrated to UE5.1.1, and my project can’t run (packaged only). It’s start by a black screen, and if i open the logs, this message is spam : ‘Class /Script/ETL.BL\_GameState’ with 2 nodes could not be pro…

---

## [C++ Deferred construction of UObject with parameters / initial setup?](https://forums.unrealengine.com/t/c-deferred-construction-of-uobject-with-parameters-initial-setup/503176)

<div class="topic-metadata">

**Author:** [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Replies:** 5\
**Last updated:** [March 3, 2022, 2:16pm UTC](https://forums.unrealengine.com/t/c-deferred-construction-of-uobject-with-parameters-initial-setup/503176 "2022-03-03T14:16:14Z")

</div>

I know new Actors can be spawned using: World-\>SpawnActorDeferred Which will allow me to set some public properties on them before finalizing the spawn process. However, I want to do this on UObjects as well and have …

---

## [“no default constructor exists for class ”UUserWidget“”](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077)

<div class="topic-metadata">

**Author:** [@xSheim](https://forums.unrealengine.com/u/xSheim)\
**Replies:** 11\
**Last updated:** [January 22, 2023, 5:20pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077 "2023-01-22T17:20:25Z")

</div>

I have experienced a strange issue writing the constructor of UUserWidget-inherited class. The problem appears only (checked in several other) in this class. Code: .h .cpp UserWidget.h

---

## [OnConstruction and BP construction script order](https://forums.unrealengine.com/t/onconstruction-and-bp-construction-script-order/450157)

<div class="topic-metadata">

**Author:** [@amoffat](https://forums.unrealengine.com/u/amoffat)\
**Replies:** 3\
**Last updated:** [December 19, 2022, 5:38pm UTC](https://forums.unrealengine.com/t/onconstruction-and-bp-construction-script-order/450157 "2022-12-19T17:38:34Z")

</div>

I have a C++ pawn subclass with OnConstruction overidden: void AMyPawn::OnConstruction(const FTransform& transform) { UE\_LOG(LogTemp, Warning, TEXT("OnConstruction")) Super::OnConstruction(transform); } In the …

---

## [Unreal Actor Constructor Setup & Errors](https://forums.unrealengine.com/t/unreal-actor-constructor-setup-errors/497201)

<div class="topic-metadata">

**Author:** [@Fat\_Scout](https://forums.unrealengine.com/u/Fat_Scout)\
**Replies:** 0\
**Last updated:** [February 12, 2022, 8:15am UTC](https://forums.unrealengine.com/t/unreal-actor-constructor-setup-errors/497201 "2022-02-12T08:15:28Z")

</div>

Howdy! so I’ve been diving into c++ actor building recently and I’ve been encountering a few problems within my constructor. Random things don’t give expected results or cause crashes and I think it might have to do with…

---

## [C++ call parent-constructor manually?](https://forums.unrealengine.com/t/c-call-parent-constructor-manually/358629)

<div class="topic-metadata">

**Author:** [@Napoleonite](https://forums.unrealengine.com/u/Napoleonite)\
**Replies:** 6\
**Last updated:** [November 23, 2021, 4:02pm UTC](https://forums.unrealengine.com/t/c-call-parent-constructor-manually/358629 "2021-11-23T16:02:58Z")

</div>

I would like to have full control over when the parent-constructor is called (it seems that UE4 calls it automatically and before the child-constructor). I have a piece of code in BaseEnemy (that inherits from BaseCharac…

---

## [Object Constructor Only Called When Debugging](https://forums.unrealengine.com/t/object-constructor-only-called-when-debugging/469482)

<div class="topic-metadata">

**Author:** [@ChrisMcCole](https://forums.unrealengine.com/u/ChrisMcCole)\
**Replies:** 1\
**Last updated:** [October 5, 2021, 2:50pm UTC](https://forums.unrealengine.com/t/object-constructor-only-called-when-debugging/469482 "2021-10-05T14:50:01Z")

</div>

Hello, I am trying to setup my FPSCharacter in C++ and I am creating the components and assigning them in the cpp constructor. Upon building my code, everything compiles successfully. However, once I open the editor and …

---

## [Passing arguments to constructors in UE4?](https://forums.unrealengine.com/t/passing-arguments-to-constructors-in-ue4/303372)

<div class="topic-metadata">

**Author:** [@codingteddybear\_1](https://forums.unrealengine.com/u/codingteddybear_1)\
**Replies:** 9\
**Last updated:** [July 28, 2021, 6:10pm UTC](https://forums.unrealengine.com/t/passing-arguments-to-constructors-in-ue4/303372 "2021-07-28T18:10:44Z")

</div>

As I understand it, UE4 constructors in 4.6.1 contain a single argument, passed by address, of type FObjectInitializer. This argument may not be used to store a custom-made argument list for initializing the object that …

---

## [How to properly attach scene component to other scene component in c++ constructor](https://forums.unrealengine.com/t/how-to-properly-attach-scene-component-to-other-scene-component-in-c-constructor/459446)

<div class="topic-metadata">

**Author:** [@S\_Q\_R](https://forums.unrealengine.com/u/S_Q_R)\
**Replies:** 3\
**Last updated:** [July 18, 2021, 12:47pm UTC](https://forums.unrealengine.com/t/how-to-properly-attach-scene-component-to-other-scene-component-in-c-constructor/459446 "2021-07-18T12:47:09Z")

</div>

Hi. I got pretty simple question but I can’t manage to make it work so here is the code and motivation. I want to make scene component that will have some collision shape and some functionality (lets call it Interactor…

---

## [USTRUCT has no appropriate default constructor](https://forums.unrealengine.com/t/ustruct-has-no-appropriate-default-constructor/476460)

<div class="topic-metadata">

**Author:** [@AgentArachnid66](https://forums.unrealengine.com/u/AgentArachnid66)\
**Replies:** 1\
**Last updated:** [February 15, 2021, 9:01am UTC](https://forums.unrealengine.com/t/ustruct-has-no-appropriate-default-constructor/476460 "2021-02-15T09:01:39Z")

</div>

I’m trying to make a simple saving and loading system for my neural network, so have made a file containing my structs, which has the following USTRUCT USTRUCT(BlueprintType) struct FTopology { GENERATED\_USTRUCT\_BODY…

---

## [コンストラクタエラーについてAFood::AFood(float satiety) : Satiety(satiety)](https://forums.unrealengine.com/t/afood-afood-float-satiety-satiety-satiety/478178)

<div class="topic-metadata">

**Author:** [@koutaaiba](https://forums.unrealengine.com/u/koutaaiba)\
**Replies:** 1\
**Last updated:** [February 4, 2021, 11:48am UTC](https://forums.unrealengine.com/t/afood-afood-float-satiety-satiety-satiety/478178 "2021-02-04T11:48:13Z")

</div>

タイトルの通りこのコードがなぜかエラーを起こしてしまっております。 ue4 c++ではコンストラクタ引数を使う場合FObjectInitializerというものしか 使うことができないのでしょうか？ AFood::AFood(float satiety) : Satiety(satiety)

---

## [USTRUCT constructor argument in Blueprint](https://forums.unrealengine.com/t/ustruct-constructor-argument-in-blueprint/477150)

<div class="topic-metadata">

**Author:** [@GenerationLost](https://forums.unrealengine.com/u/GenerationLost)\
**Replies:** 0\
**Last updated:** [January 12, 2021, 4:22pm UTC](https://forums.unrealengine.com/t/ustruct-constructor-argument-in-blueprint/477150 "2021-01-12T16:22:49Z")

</div>

I’ve found nothing regarding my question, so I ask it here: Is it possible to “Make Struct” within Blueprints and provide arguments to the struct’s constructors if there’s more than the default constructor? The “Make St…

---

## [How to properly initialize a Custom Actor in C++](https://forums.unrealengine.com/t/how-to-properly-initialize-a-custom-actor-in-c/473040)

<div class="topic-metadata">

**Author:** [@teutonicdesign](https://forums.unrealengine.com/u/teutonicdesign)\
**Replies:** 2\
**Last updated:** [October 20, 2020, 2:29pm UTC](https://forums.unrealengine.com/t/how-to-properly-initialize-a-custom-actor-in-c/473040 "2020-10-20T14:29:15Z")

</div>

Hi community members, I’m having trouble initializing my custom actor in C++. How do you attach skeletal mesh? The DefaultSceneRoot was also not showing in my BP child class of this actor. Sorry I’m still very new to UE…

---

## [Occur fatal error 1853 after use FObjectInitializer](https://forums.unrealengine.com/t/occur-fatal-error-1853-after-use-fobjectinitializer/463927)

<div class="topic-metadata">

**Author:** [@RedChiken](https://forums.unrealengine.com/u/RedChiken)\
**Replies:** 1\
**Last updated:** [April 20, 2020, 5:59am UTC](https://forums.unrealengine.com/t/occur-fatal-error-1853-after-use-fobjectinitializer/463927 "2020-04-20T05:59:08Z")

</div>

I tried to edit Character Movement Component to custom one. I found some Youtube Tutorial https://www.youtube.com/watch?v=Of8SGBa3WvU, and follow it. When I build in VS, Everything is fine. But When I build in UE4 Edit…

---

## [How do i get a cpp class into another?](https://forums.unrealengine.com/t/how-do-i-get-a-cpp-class-into-another/462198)

<div class="topic-metadata">

**Author:** [@JonathanCDev](https://forums.unrealengine.com/u/JonathanCDev)\
**Replies:** 2\
**Last updated:** [March 9, 2020, 1:49am UTC](https://forums.unrealengine.com/t/how-do-i-get-a-cpp-class-into-another/462198 "2020-03-09T01:49:29Z")

</div>

I have 2 cpp Actor Classes one is the main ground the other just billboards components. How can i get the Billboard class actor into the constructor of the main ground cpp class actor? i have tryed: CreateDefaultSubObj…

---

## [initializing a class reference member](https://forums.unrealengine.com/t/initializing-a-class-reference-member/457276)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_81655d74](https://forums.unrealengine.com/u/anonymous_user_81655d74)\
**Replies:** 1\
**Last updated:** [November 5, 2019, 7:20pm UTC](https://forums.unrealengine.com/t/initializing-a-class-reference-member/457276 "2019-11-05T19:20:41Z")

</div>

Simple question but not sure I’ve found a good answer after digging around. How do you initialize a class member reference variable? Example: My ActorComponent has a TArray\<\>& member variable. Ideally one of my constr…

---

## [How do I setup nested components in c++](https://forums.unrealengine.com/t/how-do-i-setup-nested-components-in-c/427752)

<div class="topic-metadata">

**Author:** [@Fuzzmunch](https://forums.unrealengine.com/u/Fuzzmunch)\
**Replies:** 1\
**Last updated:** [August 28, 2019, 3:01pm UTC](https://forums.unrealengine.com/t/how-do-i-setup-nested-components-in-c/427752 "2019-08-28T15:01:32Z")

</div>

So what I’m trying to setup is basically a USceneComponent that I can add with the ‘add component’ button in blueprints that comes with a UStaticMeshComponent already attached. Not sure that this is possible but it seems…

---

## [Having to recreate blueprints on C++ constructor changes?](https://forums.unrealengine.com/t/having-to-recreate-blueprints-on-c-constructor-changes/349607)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_dc33b914](https://forums.unrealengine.com/u/anonymous_user_dc33b914)\
**Replies:** 3\
**Last updated:** [July 8, 2019, 1:38pm UTC](https://forums.unrealengine.com/t/having-to-recreate-blueprints-on-c-constructor-changes/349607 "2019-07-08T13:38:55Z")

</div>

Hello, I’m not sure if this has been answered before, sorry if it has - I couldn’t find any threads with this question! I have been having an issue where any constructor changes to various parent actors in C++ are not …

---

## [Conditionally Create Components in Constructor](https://forums.unrealengine.com/t/conditionally-create-components-in-constructor/449769)

<div class="topic-metadata">

**Author:** [@rayunforsaken](https://forums.unrealengine.com/u/rayunforsaken)\
**Replies:** 3\
**Last updated:** [May 29, 2019, 9:14am UTC](https://forums.unrealengine.com/t/conditionally-create-components-in-constructor/449769 "2019-05-29T09:14:56Z")

</div>

I want my BaseItem classes to support either a static mesh or skeletal mesh, and I don’t want to create 2 separate components if only one is going to be used. I’ve set up some properties in an attempt to support that: …

[Next page](https://forums.unrealengine.com/tag/constructors/8650.md?match_all_tags=true&page=1&tags%5B%5D=constructors)
