# Replacing Blueprint Variable with C++ variable easier?

**URL:** <https://forums.unrealengine.com/t/replacing-blueprint-variable-with-c-variable-easier/292930>\
**Category:** C++\
**Tags:** variables, unreal-engine, question, Blueprint, CPP\
**Created:** [September 5, 2014, 2:59am UTC](https://forums.unrealengine.com/t/replacing-blueprint-variable-with-c-variable-easier/292930 "2014-09-05T02:59:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![CJ31387](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CJ31387](https://forums.unrealengine.com/u/CJ31387)\
**Post date:** [September 5, 2014, 2:59am UTC](https://forums.unrealengine.com/t/replacing-blueprint-variable-with-c-variable-easier/292930/1 "2014-09-05T02:59:26Z")

</div>

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

[http://imagizer.imageshack.com/img913/8255/M6IRzL.png](http://imagizer.imageshack.com/img913/8255/M6IRzL.png)

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.

---

<div class="post-metadata">

**Author:** ![joeGraf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joeGraf](https://forums.unrealengine.com/u/joeGraf)\
**Post date:** [September 5, 2014, 3:13pm UTC](https://forums.unrealengine.com/t/replacing-blueprint-variable-with-c-variable-easier/292930/2 "2014-09-05T15:13:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Pampersrocka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pampersrocka](https://forums.unrealengine.com/u/Pampersrocka)\
**Post date:** [January 18, 2019, 1:45pm UTC](https://forums.unrealengine.com/t/replacing-blueprint-variable-with-c-variable-easier/292930/3 "2019-01-18T13:45:56Z")

</div>

Since this pops up in google searches:

There is the [Core Redirects](https://docs.unrealengine.com/en-us/Programming/Assets/CoreRedirects) 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.

---

<div class="post-metadata">

**Author:** ![Esenin27](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Esenin27](https://forums.unrealengine.com/u/Esenin27)\
**Post date:** [August 30, 2021, 12:09pm UTC](https://forums.unrealengine.com/t/replacing-blueprint-variable-with-c-variable-easier/292930/4 "2021-08-30T12:09:21Z")

</div>

Now you can do it like this:

1. Rename your blueprint’s variable, for example MyVariable\_old
2. Create in C++ class new variable and complile
3. In blueprint right click on MyVatiable\_old, and select Replace References
4. In “Replace with” select your C++ vatiable and press “Find and Replace All References”

---

<div class="post-metadata">

**Author:** ![RickdeV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rickdev/32/771795_2.png) [@RickdeV](https://forums.unrealengine.com/u/RickdeV)\
**Post date:** [October 24, 2023, 3:59pm UTC](https://forums.unrealengine.com/t/replacing-blueprint-variable-with-c-variable-easier/292930/5 "2023-10-24T15:59:58Z")

</div>

I’ve tried to do exactly this, but for some reason the c++ variables don’t show up in the list. Is there something i need to toggle for them to show?

---

<div class="post-metadata">

**Author:** ![Esenin27](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Esenin27](https://forums.unrealengine.com/u/Esenin27)\
**Post date:** [October 30, 2023, 4:30pm UTC](https://forums.unrealengine.com/t/replacing-blueprint-variable-with-c-variable-easier/292930/6 "2023-10-30T16:30:14Z")

</div>

Did you give access to the variable inside the blueprints?  
Before the variable you need to add a line with UPROPERTY:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = “MyCategory”)  
float MyVariable = 100.0f;

---

<div class="post-metadata">

**Author:** ![RickdeV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rickdev/32/771795_2.png) [@RickdeV](https://forums.unrealengine.com/u/RickdeV)\
**Post date:** [November 5, 2023, 2:54pm UTC](https://forums.unrealengine.com/t/replacing-blueprint-variable-with-c-variable-easier/292930/7 "2023-11-05T14:54:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BIGTIMEMASTER](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bigtimemaster/32/710746_2.png) [@BIGTIMEMASTER](https://forums.unrealengine.com/u/BIGTIMEMASTER)\
**Post date:** [April 13, 2024, 7:09pm UTC](https://forums.unrealengine.com/t/replacing-blueprint-variable-with-c-variable-easier/292930/8 "2024-04-13T19:09:40Z")

</div>

Update in 2024.

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.

Very handy!
