Download

Proper way to implement a spellbar system (can I create object instead of spawning actors?)

I have a container for spells (the spellbar) and a list of Spells.

Atm they are both Actor and it is great cause I just spawn everything at BeginPlay and that’s it.
The problem is that Actor also takes a Position and I’m currently spawning everything at (0,0,0), what I’m worried about is that when the character is moving too far away or I use stuff like level streaming, they will eventually get disposed (or they have side-effects like preventing the level at (0,0,0) to unload with level streaming).
Of course the real solution would be to not use Actor but just a simple Object but I’m not sure that it can be done in blueprints and I don’t wanna implement distruptor.

Any suggestion?

basically I’m trying to convert GetDefaultObject<>() from C++ to blueprints without using spawnActor

4.9 is coming next week , I think
You will be able to construct Objects in BP

hoah!

just out of curiosity, how did other people do that before that? they use c++ or they spawn actor in a specific position?

Yes, either you make yourself a UObject in C++ (with which you can create your own BlueprintCallable Function to create this UObject)
or, you create them as Actors, which is ok too. Since these Actors don’t have something to draw (mesh/model) it is ok to use them (:

In my case i just attach (with Snap to target) any actors like these to my player. I also have all my Spells as Actors. But this:

… Is interesting :slight_smile:

Yeah I would be adding them to the actual player character rather than spawning them at 0,0,0