# How to create a constant in blueprint?

**URL:** <https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4, Blueprint, question\
**Created:** [April 27, 2016, 1:03pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664 "2016-04-27T13:03:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_08c2fdfc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_08c2fdfc](https://forums.unrealengine.com/u/anonymous_user_08c2fdfc)\
**Post date:** [April 27, 2016, 1:03pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664/1 "2016-04-27T13:03:23Z")

</div>

How can I create a constant (a node containing a value with one output) in Blueprint?

---

<div class="post-metadata">

**Author:** ![goncasmage](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@goncasmage](https://forums.unrealengine.com/u/goncasmage)\
**Post date:** [April 27, 2016, 6:11pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664/2 "2016-04-27T18:11:52Z")

</div>

I don’t think you can… that feature is mainly a performance reducing one in C++, and blueprint doesn’t really work like that i guess…

---

<div class="post-metadata">

**Author:** ![ryanjon2040](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ryanjon2040/32/906587_2.png) [@ryanjon2040](https://forums.unrealengine.com/u/ryanjon2040)\
**Post date:** [April 27, 2016, 8:07pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664/3 "2016-04-27T20:07:29Z")

</div>

You can make the variable private and create a BlueprintPure (enable const) that returns the variable. This way no other classes (even child classes) will be able to set that value to anything else.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_08c2fdfc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_08c2fdfc](https://forums.unrealengine.com/u/anonymous_user_08c2fdfc)\
**Post date:** [April 28, 2016, 12:38pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664/4 "2016-04-28T12:38:38Z")

</div>

To create a variable node, you can select and drag an input, and on the context menu which pops when you drop, select: “Promote to variable”.

---

<div class="post-metadata">

**Author:** ![Daniel\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Daniel\_K](https://forums.unrealengine.com/u/Daniel_K)\
**Post date:** [December 13, 2016, 10:33pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664/5 "2016-12-13T22:33:08Z")

</div>

I think I found best way to do constants using blueprints - Macro Library. Just create one and then in there you can create simple macro like this…

[https://cdn.pbrd.co/images/9t1OTeCgn.png](https://cdn.pbrd.co/images/9t1OTeCgn.png)

And then use it whenever you want, no need for execution pins, acts like getter for a variable.

[https://cdn.pbrd.co/images/9t38stduD.png](https://cdn.pbrd.co/images/9t38stduD.png)

---

<div class="post-metadata">

**Author:** ![Arty-McLabin](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arty-mclabin/32/1012076_2.png) [@Arty-McLabin](https://forums.unrealengine.com/u/Arty-McLabin)\
**Post date:** [February 4, 2018, 1:20pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664/6 "2018-02-04T13:20:33Z")

</div>

functional programming workaround for class dependent constants:

![229429-screenshot-5.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/0/d/d0df99a28135d561257666d08dfa6bf8e2733101.png)

keep that function pure also.

---

<div class="post-metadata">

**Author:** ![ThompsonN13](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThompsonN13](https://forums.unrealengine.com/u/ThompsonN13)\
**Post date:** [February 4, 2018, 4:15pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664/7 "2018-02-04T16:15:27Z")

</div>

try using the make literal node. of course this depends on type of value that you want to be a constant but you can use a make literal in a variety of situations. you could also use variables, addition nodes, and conversion string to int or something like that.

---

<div class="post-metadata">

**Author:** ![Bronzdragon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bronzdragon](https://forums.unrealengine.com/u/Bronzdragon)\
**Post date:** [February 4, 2018, 7:03pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664/8 "2018-02-04T19:03:37Z")

</div>

It’s not only a performance feature, but it’s also to save yourself from making mistakes. If it’s a constant value, you can’t accidentally write a different value to it. You can also instantly tell that it will only ever have one value. It’ll save you headaches later down the line when you go “But how come this value is changing?!” while debugging.

---

<div class="post-metadata">

**Author:** ![mrm\_dev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mrm\_dev](https://forums.unrealengine.com/u/mrm_dev)\
**Post date:** [December 9, 2024, 5:46pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664/10 "2024-12-09T17:46:28Z")

</div>

Incase anyone wants to expose a static constant from c++ to blueprint:

.h file:

```cpp
UCLASS()
class MYPROJECT_API UMyCharacterStatic : public UBlueprintFunctionLibrary
{
    GENERATED_BODY()

    public:
        UFUNCTION(BlueprintPure)
        static float GetMyConstant();
};

UCLASS()
class MYPROJECT_API AMyCharacter : public ACharacter {
    GENERATED_BODY()
    
    public:
      static const float MY_CONSTANT;

);

```

.cpp file

```cpp
const float AMyCharacter::MY_CONSTANT = 10.5f;

float UMyCharacterStatic::GetMyConstant(){ return AMyCharacter::MY_CONSTANT; }

```

This way you can use the static constant inside c++ and expose it to blueprints as well:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/9/6d9462c277f7e6d845c55e27fdd8e3e56ea96121.png)

---

<div class="post-metadata">

**Author:** ![Victirobo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Victirobo](https://forums.unrealengine.com/u/Victirobo)\
**Post date:** [December 21, 2025, 2:08pm UTC](https://forums.unrealengine.com/t/how-to-create-a-constant-in-blueprint/355664/11 "2025-12-21T14:08:19Z")

</div>

You can tick “Blueprint Read Only” on Details section of your variable :

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/a/e5aba27e9ca489bb33146a2a651bba5bec9850aa.png)
