Why is my Child Actor component causing a crash?

Hi,

I have a few custom actors and trying to make a prefab out of them. So i basically add “Child Actor” component in blueprint for every actor i want to add to prefab, apparently it excessively crashes after first blueprint compilation for some reason…

Info on crash below in the comments

Appreciate any help, regards.

Callstack on crash. Really no idea what causes it.

You can’t have actor as a part of component, actor should be made out of components. You need to set up components in actor class constructor, editor will automatically detect constructed components and when you make a child in blueprint they will be in component editor. I write example of that how to set up components here:

Yeah thanks, but i know how to work with components, you seems to misunderstand my question. I didn’t ask how to initialize component inside actor, i’m trying to find out how to create your own component based on actor.

Ahhh so you want to mix diffrent presets of components and what to access actor from it? If actor is null it means your component is not attached to actor at point you doing things

What i’m trying to achieve exactly is this:

I have physical driven door which is separate actor; i’m trying to make a prefab, which consist of few actors and the door is one of them, simply adding door as “Child Actor” inside blueprint components didn’t lead to anything good(it’s in question itself, and also has some more weird things), so i’m trying to implement that door actor as actor component.

Thanks for replies, will let you know if i achieved something or not.

Ah you right htere is child actor component didnt know about it sorry, i guess you might missing something, or actor behave diffrently as components

Found where it crashes.

Crashes on blueprint compilation, first 1-2 compilations going fine, but if i compile blueprint third time - it crashes.

And there’s another bug about using Child Actor component, inside editor prefab looks fine, but after hitting Play it creates 2 more instances of each ChildActor, one at the same location where actor should be placed in prefab, and another at world zero transform.

Update

That’s all happens only inside editor, if i launch game as standalone process within editor - everything works fine, it does not crash and only one instance is created.

Guys at Epic, if you happen to see this topic at all, would like to share code which causes this weird stuff.

Renamed topic in the mean time.

We have fixed at least one issue with ChildActorComponent in 4.1, but this sounds more like an issue with event binding. Do you have a step-by-step repro we could follow to reproduce the problem here?

Yeah i’ve tried building 4.1 to see if it was fixed, unfortunately it was not.

So what i have here is this:

class AInteractiveObject : public AActor;
class ADoor : public AInteractiveObject;
class AHidingSpot : public AInteractiveObject;

Then i create blueprint based on AHidingSpot and add two Child Actor components of ADoor. There’s no need to base this prefab on AHidingSpot actually, so i’ve tried replacing it with AActor, but the problem still exists in this case, so it’s not the problem within my objects i guess. Attaching code for these objects.

Thanks!

Oh sorry forgot to mention that i got rid of delegates binding as i’ve changed objects interaction, question is little bit misleading now because of comments… The binding error was happening on PIE, not on blueprint compilation. Cleaned comments.

https://github.com/EpicGames/UnrealEngine/commit/8806470f04233e978db89b7eef4a1116df415711 seems to fix the issue.

For information this is not because of your code in any way because… it happens in blueprints while setting up components too. I made a new blueprint derived from Pawn and gave it a SceneComponent as Root. Then added a first StaticMesh to it. I added a ChildActor and at some point it crashed the editor. My blueprint was absolutely blank and the Defaults were untouched. I can’t tell exactly when it occurs though.

It crashes during blueprint compilation, if i recall correctly.

But the most annoying part here is duplicated objects in PIE. Noticed another thing about it not so long time ago, “original” actor, that exist in blueprint components, moves to world zero transform, and duplicated objects move to the actor.

You guys notice these things quickly :stuck_out_tongue:

I do believe there is still some issues with child actor component (and really all BP actors due to the re-running of the construction script) and the undo buffer which remain unresolved that I’m talking to people to try and figure out what to do about. However, this should fix your duplicate issue.

I have the same issue with Child Actor (I’m working on 4.1). The site no longer exists. Could you post this fix here?

Hi alwalt93,

The link mentioned above is to an update to version 4.2 code on GitHub. If you are using an Engine compiled from source code, you can log into GitHub and will be able to get this update and merge it into your 4.1 code. It should work fine, though it is obviously intended to be used with 4.2.

If you are using the Engine using binaries from the Launcher, then you won’t be able to implement this fix into 4.1, though updating to 4.2 will include the fix.

Thanks! I’m working on binaries from the Launcher, so I’ll just get 4.2 version.

If you need any additional help, please let us know. However, it may be best to create a new post so we can focus on it better.