Unable to pinpoint crash source
I currently am working on a c++ door system. My current setup is made of two classes, AAutomatedDoorFramework and AADoor.
AADoor contains several functions to setup the door movement and actually run it (with Tick()). AAutomatedDoorFramework is supposed to instance it.
Here's a code snippet : AutomatedDoorFramework.h
AFAIK, the ObjectInitializer will call AADoor's constructor in some way. However the crash report doesn't seem to say that the problem was in the constructor :
I've been fiddling with this for quite some time, but am still quite new to UE4 so I'd need some pointers. Any kind of help would be appreciated :)
asked Feb 18 '15 at 03:06 PM in C++ Programming
You can't initialize an actor as a subobject.
This line "//Script//DoorFramework.Default__AutomatedDoorFramework to Level failed" in the error message tells you that AADoor expects a level as its outer object.
You can use SpawnActor to spawn the door as an actor and then keep a reference to it. You could also try using a ChildActorComponent.
answered Feb 18 '15 at 03:13 PM
I'm still under 4.5 but from what I understand, you are trying to spawn an Actor as a component. First off, your Actor being name Component is a conceptual mistake. An Actor is NOT a component. It is was is holding components. Now ObjectInitializer.CreateDefaultSubobject is used to spawn component for the actor, not actual Actors.
To spawn Actors you want to use World::SpawnActor.
answered Feb 18 '15 at 03:18 PM
Alright so now I use
That causes no more crashes. However, I get 2 doors spawned. One when I drag the AAutomatedDoorFramework in the editor, and one when I release the mouse button. I end up with 1 AutomatedDoorFramework and 2 Doors. What could cause this ?
answered Feb 18 '15 at 04:09 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here