Sometimes the child actor is destroyed for some reasons

I set a actor and put a child actor named PVPEModel in it. After the BeginPlay I set the child actor like this:

But when I ran it, some errors about the reference told me the “PVEModel” was destroyed. But I didn’t do it.

I used “PVEModel” in an event and debuged it. Then I found that the event was called in correct place but the two break nodes were not triggered inside the event.

I felt very confused because the error did not appear every time. I guess it is associated with the logic in the BeginPlay. Any help?

You shouldn’t change a child actor component’s class at runtime. That’s why you are having weird errors. Try just setting the class in the editor, or why do you need to set it on begin play? What are you trying to achieve?

In my actor, I have several components(widgets, child actors, etc). The child actor is used for different models and these models are actors because they are not a whole static mesh. Several model parts constitute a child actor. I set a child actor to control these static meshes inside my child actor(move, scale or rotate)

You should try attaching actors instead of using child actor components