Adding BP_Object to TARRAY - Object added before initialization
I have an array of spelltype objects that is basically a spellbar holding references to spells that get added dynamically from blueprints. My issue is that lets say I have BP_FireBall, that I used via exposing C++ class named ASpellSystem, adding that BP_Fireball to my TArray comes in invalid. I'm assuming that is getting added before it gets initialized but not sure how to go about fixing this when the init values are set in blueprints.
Here is a screenshot from my character bp - mind you the fireball is invalid in the bp
and here is one from the fireball it self - in here testing if valid passes since it is after beginplay for the fireball bp:
I was told to use
Also I was researching and I could maybe use PostInitComponents() and call it on the spell getting added, but not sure how to go about this, since all the values get setup under BluePrint_Class_Defaults.
I looked at the other post with the same question but it did not help me.
asked Apr 04 '15 at 07:34 PM in C++ Programming
You do not show how/where your Fireball2 variable is being initialized. Your problem is either that that initialization is failing, or is not being done at all. Your BP_Fireball is just a blueprint, not an instance. You need to spawn an instance of your blueprint somewhere and assign that to Fireball2, and this needs to be done before calling AddSpellToBar.
If you are initializing it somewhere, post the relevant code/BP and I'll try to see what the problem is.
answered Apr 07 '15 at 07:29 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here