Initialize object of custom class from blueprint
I've created a C++ class called "Item" that holds an array of another class of mine, named "ItemEvent". This works fine if I add events via C++, but for ease of use I'm trying to enable the addition of events via blueprint also.
I have several blueprints that derive from "item". Item has a function named "AddEvent" which accepts a pointer to an ItemEvent and simply adds it to the existing TArray. My issue is that, when I create new variables in my blueprint of my various ItemEvent types, they are never initialized by default.
I have begun trying to call the following node on the BeginPlay event to initialize these objects: https://docs.unrealengine.com/latest/INT/BlueprintAPI/Game/ConstructObjectfromClass/index.html
My issue is that this does not work, and provides the following error:
The object "SwingOneHandedWeaponEvent" is a really simply C++ class derived from ItemEvent. No matter which class I pick here, I seemingly always get the "wrong class to spawn" error.
Am I going about this incorrectly? All I wish to achieve here is to initialize the variables that I include on my blueprint when the object is created at runtime, so when I access them later they are not null.
Any and all help would be greatly appreciated!
asked Oct 19 '16 at 08:30 AM in Blueprint Scripting
Follow this question
Once you sign in you will be able to subscribe for any updates here