Is there a way to move a property from blueprint into c++?

Is it possible to take a variable that was defined in blueprint and move it into its parent c++ class? More specifically, doing this without destroying all of the scripts and data associated with it.

I believe it would be possible, but an easier approach might be to create BP exposed function where you can hand that value into.

I haven’t found a great way to do this, but the following works. You can define the variable in the C++ class and recompile the project. It automatically renames your blueprint variable with a _0 at the end. You can then do a find references on that variable with the _0 and manually swap the references to your new C++ version. External references to that variable won’t complain, but they also won’t work and you’ll have to swap them manually too.

Methods are a bit harder, but you can do something similar, though in reverse to prevent anything from breaking as you do it. Rename the method in question, just append a BP or something and let the editor work its magic in renaming all the references. Then define the method, using the real name, in C++ and, after compiling, go in and manually change the references in the editor. I prefer, on first pass, to make it either a BlueprintNativeEvent or a BlueprintImplementableEvent because then I can override it and copy the blueprint code from my old method into it in the editor and move logic down into C++ afterwards.

This is tedious and, after having to do this several times due to lack of foresight in one of my original learning projects, my current preferred mode of operation in a mixed blueprint/C++ project is to define ALL variables and methods in C++ and override logic as desired in blueprints. It’s just too painful to fix it after the fact.

I’m probably missing something simple and obvious, since I arrived at this by trial and error, so if someone knows a better way to do this, I’d love to hear it too.

You can access blueprint declared variables by name using Reflection, but it’s ugly and unsafe.

This about sums up all of my investigation, as well. I’m disappointed to find out that this is the case. Thanks for your reply.

Well, there must be a lot of us missing it, then, because manually switching variables around is the only way I’ve found, too.