Array of BP Classes (TSubClassof) - always empty

Hi guys,

I been stuck on this issue for a couple of weeks now and I just simply cant get it to work the way I need it to. Basically a player picks the spells he/she wants to use, they get added to an array of Tsubclassof and I spawn the actors from said array (Spell Bar). I’m adding the spells using UMG/Blueprint but no matter what I do, the spellbar array is always empty. Mind you I can get the spells to cast under certain circumstances.

*I know add to spell is not connected, it is just for demonstration purposes, I have tested it with BeginPlay, etc.
*I tried added defaultobjects but that also didn’t work.

Here is the C++

In this situation, the spell does no cast. The only way to make it work is to Cast to FB class → Set FBSpell. But I dont want to go this route as there will be 100s of spells, and the player will pick any at random.

In this scenario I can cast the spell by using the dropdown menu to find the FB class (Cant use a variable), but unless I use set spellbar, the add to spellbar method still produces an empty array. (I want to add conditions on add,thats why cant use a regular set spellbar).

Thank you,

1 Like

So I finally fixed it for who ever gets stuck on this, pretty trivial thing to look over.

First I had to select default value for FB Class Object

41457-screenshot+-+5_5_2015+,+9_45_33+am.png

Second I had to use GetClass() instead of StaticClass() to return the default class object, instead of an empty class.

41456-screenshot+-+5_5_2015+,+9_49_03+am.png

1 Like