I hopethe title is descripive enough.
So it is probably total noob question, but I just stucked on it.
I have this:
UFUNCTION(BlueprintCallable, Category=Inventory)
void EquipAbility(ARPGAbility* ability);
Then I create Blueprint, that have this method (Character), I add this method inside Blueprint Event Graph.
And there is an field ability, where I should add my ability. The problem is that it wants particular object (which is rather obvious I don’t want any ability I want that one ability).
I though it is enough to create new Blueprint that will inherit, from set class (in this case RPGAbility), and it will be just treated like object (now that I think about it, it would quite stupid).
So my question is, how to convert my class blueprint to object that I can use with my custom function ?
I think you will have to spawn an instance of ARPGAbility, using a SpawnActor node. Then you should be able to pass it to that function. It wants an instance, not the class. Alternatively you could make your function take a class instead:
UFUNCTION(BlueprintCallable, Category=Inventory)
void EquipAbility(TSubclassOf ability);
Though until we have the ‘Blueprint Comms’ feature (next beta) you will not be able to specify or spawn a Blueprint class.
Thanks for answer.
I’m not sure if chaning code right now would be optimal, because I have other code that depends on this methods, but that something that should be examined closer.
I think that changing everything to TSubclassOf, while would be blueprint friendly, I’m not so sure if it would be so much coding friednly in long run. (and what I basicaly want to do is to create more or less simple “components” for use in blueprints to create abilities from them, an Blueprint driven ability creation system)
Anyway I think the second solution would be optimal. Creating object of class directly in blueprint would simply things.
In any case, I have to wait and see which solution would prove better.