# \[Question\] The Class Constructor and You

**URL:** <https://forums.unrealengine.com/t/question-the-class-constructor-and-you/275637>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [March 11, 2014, 2:34am UTC](https://forums.unrealengine.com/t/question-the-class-constructor-and-you/275637 "2014-03-11T02:34:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:34am UTC](https://forums.unrealengine.com/t/question-the-class-constructor-and-you/275637/1 "2014-03-11T02:34:09Z")

</div>

Okay so Ive been messing about, mainly failing but Ive come across something. When assigning components to my Character Actor in C++ the heirarchy set in the constructor isnt updated unless I create a new Blueprint from my Class. Now this makes sense but in a way it doesnt, because its extremely easy to assign and move components around within the blueprint editor, now Im stuck having to copy/paste alot of functionality from one Blueprint to another because I cant change the component heirarchy simply.

I understand the reasoning for having them fixed as the class is fixed but its the fact that the Class Constructor isnt run at all after the Blueprint initial creation thats worrying. I really want to be working in C++ and have my changes propagate and I thought this was one of the perks we would have in the new system vs the Old Archetypes but it seems the limitations will be there regardless.

What Im wondering is what the best workflow is, should I work just in Blueprint and ignore C++ because not all changes propagate? Or should I be working strictly in C++ and not start any Blueprint until Im finished, which is similar to Archetypes? Id prefer if I could switch between them and use them hand in hand, though Im not sure I’ll be accessing Blueprints from C++ as much most people will with hardcoded links to objects (agan like Archetypes).

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:34am UTC](https://forums.unrealengine.com/t/question-the-class-constructor-and-you/275637/2 "2014-03-11T02:34:10Z")

</div>

Sorry for the trouble. We have had a few discussions about similar problems internally, I’m not quite sure if they are exactly what you describe though. We’ll get back to you soon.

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:34am UTC](https://forums.unrealengine.com/t/question-the-class-constructor-and-you/275637/3 "2014-03-11T02:34:11Z")

</div>

That’s not a problem, I think these changes require a restart when doing it via the component editor its actually faster, there is no way to get that back into code.

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:34am UTC](https://forums.unrealengine.com/t/question-the-class-constructor-and-you/275637/4 "2014-03-11T02:34:11Z")

</div>

Just marking this as done n dusted!

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:34am UTC](https://forums.unrealengine.com/t/question-the-class-constructor-and-you/275637/5 "2014-03-11T02:34:12Z")

</div>

_“When assigning components to my Character Actor in C++ the heirarchy set in the constructor isnt updated unless I create a new Blueprint from my Class”_

* * *

You dont have to go as far as creating a new blueprint.

Even though the check mark is green, **just click Recompile anyway** , and it will update the constructor and the hiearchy properly.

I’ve already reported this issue here were I had to debug it for three hours to figure it out (so I can relate to your concern) 🙂

[https://rocket.unrealengine.com/questions/6839/staticmeshcomponent-added-in-c-only-shows-after-cl.html](https://rocket.unrealengine.com/questions/6839/staticmeshcomponent-added-in-c-only-shows-after-cl.html)

Rama

PS: Epic staff repro-ed this issue and reported it according to my thread above

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:34am UTC](https://forums.unrealengine.com/t/question-the-class-constructor-and-you/275637/6 "2014-03-11T02:34:12Z")

</div>

I did actually try all 3 compile buttons. The heirarchy doesnt change because attach has already been called:

```
/** First person camera */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera)
TSubobjectPtr EyeCameraComponent;

// Create a CameraComponent 
EyeCameraComponent = PCIP.CreateDefaultSubobject(this, TEXT("EyeCamera"));
EyeCameraComponent->SetWorldScale3D(FVector(0.5, 0.5, 0.5));
EyeCameraComponent->AttachParent = Mesh;
Components.Add(EyeCameraComponent);

```

Pretty standard Camera Constructor, that Parent doesnt get updated no matter how much I compile. If I knew the logging Id do an editor output. Biggest buff there is C concat, cool.

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:34am UTC](https://forums.unrealengine.com/t/question-the-class-constructor-and-you/275637/7 "2014-03-11T02:34:13Z")

</div>

Hmm, well I hope Epic can help you with this

#Editor Logging  
Regarding logging, in your editor shortcut, you can add -log to the end, here’s my editor shortcut:

```
"C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe" -log

```

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:34am UTC](https://forums.unrealengine.com/t/question-the-class-constructor-and-you/275637/8 "2014-03-11T02:34:13Z")

</div>

Umm the log its on the windows tab, I was talking about the actual C++ logging commands.
