Constructor call crashing the editor (UObject() constructor called but...)
I've been working on a small project for some time. Now what I'm trying to do is rather simple : attach an AActor object to a skeletal mesh socket. I created a generic class for my pieces of gear (helmet, sword...), so my helmet class inherits from the gear class. I put some code in it, but it crashes the UE4 editor! The log didn't allow me to understand why this was happening. Here it is.
Does anyone know what's wrong? I tried initializing the model parameter outside of the initialization list in Gear's constructor, but it doesn't change anything.
Thanks in advance and sorry if my explanation is lacking pieces.
Edit: Adding the class where I (try to) instantiate my helmet : header and cpp file. I commented the bit where I tried using the NewObject() method (having this time a pointer to my ATTTHelmet in the parameters, commented out too). NewObject() also causes a crash.
Okay, so I found out what was wrong.
I was trying to create an AActor object either by using its constructor, or by using NewObject(). These two methods are not how you deal with AActor. You actually have to spawn it at runtime (usually BeginPlay()) by using GetWorld()->SpawnActor().
Hope it helps someone in the future.
answered Jun 02 '16 at 12:46 PM
You have to show me a bit more. How are you Creating Your Helmet and where? can you show the line. I hope you did not use "new ATTTHelmet()" to Construct the Helmet? The error msg you Posted is missing a Piece but if I look at line 2071 (in 4.10) it says you did not use NewObject to construct your Helmet.
Follow this question
Once you sign in you will be able to subscribe for any updates here