Hello!
I’m doing an item system and got to a point where I need to split an item stack. Basically, I have an item stack that is an actor, and I need to create a copy of it and it’s components. I’ve found SpawnActor() method does what I need when supplied with the pointer to object that needs to be copied as a template parameter. Code goes something like this:
FActorSpawnParameters Parameters;
Parameters.Template = this;
ACharacterItemBase* Clone = GetWorld()->SpawnActor<ACharacterItemBase>(this->GetClass(), Parameters);
Problem is, this works perfectly for components generated in code, but if I ever call it on an object that has additional components added through the editor, program crashes during the SpawnActor function call (no log). I have tried running the debugger and caught an “Access violation writing location” exception at mallocTBB.cpp line 93.
Am I doing something terribly wrong here or is it an engine bug perhaps?