# Get Blueprint Animation variables in C++?

**URL:** <https://forums.unrealengine.com/t/get-blueprint-animation-variables-in-c/331927>\
**Category:** Editor Scripting\
**Tags:** Variable, unreal-engine, question\
**Created:** [September 12, 2015, 1:30am UTC](https://forums.unrealengine.com/t/get-blueprint-animation-variables-in-c/331927 "2015-09-12T01:30:36Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![rantrod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rantrod](https://forums.unrealengine.com/u/rantrod)\
**Post date:** [September 15, 2015, 3:17am UTC](https://forums.unrealengine.com/t/get-blueprint-animation-variables-in-c/331927/4 "2015-09-15T03:17:32Z")

</div>

I have two options for you. First is the way I suggested already. It’s the answer usually given:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

…

Second Option:

```
    if (USkeletalMeshComponent *Mesh = MyActor->FindComponentByClass<USkeletalMeshComponent>())
    {
        if (UAnimInstance *AnimInst = Mesh->GetAnimInstance())
        {
            UFloatProperty* MyFloatProp = FindField<UFloatProperty>(AnimInst->GetClass(), AnimPropName);
            if (MyFloatProp != NULL)
            {
               float FloatVal = MyFloatProp->GetPropertyValue_InContainer(AnimInst);
               MyFloatProp->SetPropertyValue_InContainer(AnimInst, 180.0f);
               FloatVal = MyFloatProp->GetPropertyValue_InContainer(AnimInst);
            }
        }
    }

```

I put a way to get and to set in there.

This technique also works with regular blueprints, not just anim blueprints and with other types:

```
   UBoolProperty* BoolProp = FindField<UBoolProperty>(MyActor->GetClass(), PropName);
    if (BoolProp != NULL)
    {
        bool BoolVal = BoolProp->GetPropertyValue_InContainer(Actor1);
        BoolProp->SetPropertyValue_InContainer(Actor1, true);
    }

```

The names are just simple FName data types:

```
FName PropName = TEXT("MyBoolVariable");
FName AnimPropName = TEXT("MyFloatVariable");

```

Here’s the source I got it from:

> **[How to access blueprint vars in c++?](https://forums.unrealengine.com/questions/2145/how-to-access-blueprint-vars-in-c.html)**
>
> How can I acces vars I’ve created in my Character’s blueprint in the c++ character class code?

---

_[View the full topic](https://forums.unrealengine.com/t/get-blueprint-animation-variables-in-c/331927)._
