Right now since I don’t know the Engine well and C++ I’ve been making my code in blueprints then converting the code to C++, so far it has worked good but I use the same variable names. I like to unlink my blueprints after the blueprint to C++ conversion is 100% done. But I would like those variables to stay hooked up together but reference the C++ ones not the blueprint ones. Is there any way to do this or do I have to do this manually and replug everything in from my inherited C++ variables with the same name. here is a example
I have those blueprint nodes hooked up to my original blueprint variables, but now I have the same exact C++ variables exposed under playerstats that was created in C++, is there a quick way to replace those nodes with the C++ ones or do I have to do it manually? This might be considered lazy but whatever can save time is good, with a huge blueprint class converted to C++ it could waste some time relinking everything.
I like to leave the old blueprint there (but unplugged) for my team members and some stuff I keep as blueprint to send to UMG.
Since your workflow is to convert to C++ once you are far enough along, I’d start with creating the C++ classes as you go. There you can add the variables but keep the logic in Blueprints until you are ready to move it to C++. That way, you don’t have to worry about making sure which class (BP or C++) has the variable. They’ll always be in the C++ and migration will be easier.
There is the Core Redirects system one can use to achieve this:
For example you have the blueprint MyGame_GameInstanceBP with a variable bGameStarted and you created one in the C++ UMyGameInstance called bHasGameStarted. The redirect would look as follows:
; In DefaultEngine.ini
[CoreRedirects]
+PropertyRedirects=(OldName="MyGame_GameInstanceBP_C.bGameStarted", NewName="MyGameInstance.bHasGameStarted")
Note the addition of _C to the blueprint name and the ommision the U prefix for the C++ class.
After adding the redirect, you can delete the Blueprint variable and all references to it will be remapped to the new C++ variable. As long as the original variable is still there nothing will be remapped.
Yeah, i can drag them over and replace their counterpart, so they are all good in the blueprint, just don’t show up in replace references. I didn’t add a category if that makes any difference.
I just tested this out. I have a blueprint variable. I made a c++ variable of the same name in the c++ parent class. After live compile, the blueprint variable seems to have been automatically replaced.