# How to call a Anim Node Reference from code?

**URL:** <https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337>\
**Category:** C++\
**Tags:** reference, unreal-engine, CPP, question\
**Created:** [February 23, 2025, 1:29pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337 "2025-02-23T13:29:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![InvQuasar](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/invquasar/32/1027161_2.png) [@InvQuasar](https://forums.unrealengine.com/u/InvQuasar)\
**Post date:** [February 23, 2025, 1:29pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337/1 "2025-02-23T13:29:38Z")

</div>

Hi!  
I have a `Anim Node Reference` in the `AnimGraph` (screen 1). It is called both in the `AnimGraph` and in the `EventGraph` (screen 2, I’ll attach as a separate message). I want to rewrite the `EventGraph` from BP to C++ code, but I don’t understand how I can call this `Anim Node Reference` from the code. The `Anim Node Reference` has a Tag `OffsetRoot`.  
Has anyone done this before?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/e/f/eef62ab0682fcc699a9d451c0a8d73c4363f5fcb.png)

UE version - 5.5.3

---

<div class="post-metadata">

**Author:** ![InvQuasar](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/invquasar/32/1027161_2.png) [@InvQuasar](https://forums.unrealengine.com/u/InvQuasar)\
**Post date:** [February 23, 2025, 1:30pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337/2 "2025-02-23T13:30:08Z")

</div>

Screen 2

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/d/1/bd12e472b21f01c262d34594e9b53163f39189db.png)

---

<div class="post-metadata">

**Author:** ![SpecZynk](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/speczynk/32/1117840_2.png) [@SpecZynk](https://forums.unrealengine.com/u/SpecZynk)\
**Post date:** [February 24, 2025, 12:53pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337/3 "2025-02-24T12:53:54Z")

</div>

Hey,

So what you are looking for is an [FAnimNodeReference](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Animation/FAnimNodeReference), there is a construct where you pass the animation instance and the node you want ref.

Bye.

---

<div class="post-metadata">

**Author:** ![InvQuasar](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/invquasar/32/1027161_2.png) [@InvQuasar](https://forums.unrealengine.com/u/InvQuasar)\
**Post date:** [February 24, 2025, 1:13pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337/4 "2025-02-24T13:13:05Z")

</div>

Hi!  
This is the first method I tried. In this case, I can’t set the value in it  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/0/9/709d04c72a6a4bca8aad5382714f95baad7f0065.png)  
My code

```auto
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Anim|Essential Values")
FAnimNodeReference OffsetRootNode;

```

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [February 24, 2025, 2:32pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337/5 "2025-02-24T14:32:01Z")

</div>

> [@InvQuasar](#):
>
> `OffsetRoot`

Why not just pass it in?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/7/8/778506e6e65aa5cea7d421cf9d00f7717ecfb21d.png)

just make sure you use BlueprintReadWrite to able to write to it  
` UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Anim | Essential Values")`

---

<div class="post-metadata">

**Author:** ![SpecZynk](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/speczynk/32/1117840_2.png) [@SpecZynk](https://forums.unrealengine.com/u/SpecZynk)\
**Post date:** [February 24, 2025, 2:44pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337/6 "2025-02-24T14:44:21Z")

</div>

Yes, you can.

Set on its declaration: `FAnimNodeReference OffsetRootNode{AnimInstance, YourRefNode}`, that may compile.

In case you get any error when opening your engine, that’s because your anim instance is not inicialized yet, so you can turn that arround seting your `OffsetRootNode` on`NativeInitializeAnimation`, simple:

```auto
OffsetRootNode = FAnimNodeReference(this, YourRefNode);

```

I think that may solve this problem.

Bye.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [February 24, 2025, 2:45pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337/7 "2025-02-24T14:45:43Z")

</div>

`FAnimNode_Base` is not exposed to blueprints so it might need some scaffolding to be callable from the anim graph

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [February 24, 2025, 3:31pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337/8 "2025-02-24T15:31:41Z")

</div>

Main question though =\> what do you want to achieve from accessing it in c++? Do you want to modify it’s parameters?

---

<div class="post-metadata">

**Author:** ![InvQuasar](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/invquasar/32/1027161_2.png) [@InvQuasar](https://forums.unrealengine.com/u/InvQuasar)\
**Post date:** [February 24, 2025, 5:53pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337/9 "2025-02-24T17:53:33Z")

</div>

I have this event disabled in the BP now, since I moved everything to code. But for now I did it roughly the same way)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/a/c/3ac5c3cac659874bb5458a310e5d0f6eb095f2f4.png)

My code

```auto
UFUNCTION(BlueprintImplementableEvent, Category = "Anim|Essential Values")
FAnimNodeReference GetOffsetRootNode();

```

And no, I’m not modifying this Node in the code. I just wanted to know if there was a more humane solution.  
Apparently, the current solution is enough.  
Thanks to everyone for the help)

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 26, 2025, 5:54pm UTC](https://forums.unrealengine.com/t/how-to-call-a-anim-node-reference-from-code/2352337/10 "2025-03-26T17:54:22Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
