Blueprint and C++. Am I doing this right?
Hey guys, So I am part of the programming team. We are working on a game with a complex fighting system with many different spells. For sanity reasons I have written some C++ classes and exposed them to Blueprint for the artists to set up meshes, collision etc. inside the editor and NOT in C++. No additional coding was done inside Blueprints. Then after BeginPlay I want to create an instance of these spells. Can I use the C++ baseclass for that and still have the correct meshes specified by the artists? If not how do you deal with that?
asked Jul 17 '16 at 01:44 PM in C++ Programming
At least in general, it sound like you're doing it fine! The problem is that C++ doesn't really have access to the selections that your artists have made in the editor right now. Let's assume that you have a Spell struct that looks something like (my struct will be combat animation struct, but you could name it spell animation struct or whatever you like):
Now if I open up a blueprint that extends the MGCharacter, the artists will be able to set particular values:
Now since this isn't actually a reference to an actor but instead to arbitrary struct, I won't be able to instantiate it. But if you have a reference to an actor it will work the same way. Make sure the actor has uproperties with the EditAnywhere or EditDefaultsOnly flag. At BeginPlay you will be able to spawn that referenced actors wherever you like. I would use the BeginPlay in the character class that the spells are associated with.
answered Jul 17 '16 at 06:13 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here