# Setting a reference variable to the AnimBP in the actor construction script creates a new AnimBP instance

**URL:** <https://forums.unrealengine.com/t/setting-a-reference-variable-to-the-animbp-in-the-actor-construction-script-creates-a-new-animbp-instance/358377>\
**Category:** Blueprint\
**Tags:** unreal-engine, construction-script, Blueprint, question\
**Created:** [May 24, 2016, 6:02am UTC](https://forums.unrealengine.com/t/setting-a-reference-variable-to-the-animbp-in-the-actor-construction-script-creates-a-new-animbp-instance/358377 "2016-05-24T06:02:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_cda129a7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cda129a7](https://forums.unrealengine.com/u/anonymous_user_cda129a7)\
**Post date:** [May 24, 2016, 6:02am UTC](https://forums.unrealengine.com/t/setting-a-reference-variable-to-the-animbp-in-the-actor-construction-script-creates-a-new-animbp-instance/358377/1 "2016-05-24T06:02:42Z")

</div>

I’m using a binary UE 4.12.0 Preview 4 build. When I create an animation blueprint reference variable in the actor blueprint that owns it, and then set it in the actor’s construction script, a new animation blueprint instance is created instead of a reference to the current animation blueprint.

Repro steps:

1. Create a new ThirdPersonCharacter blueprint project for testing.

2. Open the ThirdPersonCharacter blueprint and add a new variable of type “Third Person Anim BP Reference” called “MyAnimBP”.

![91750-repro1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/6/a/d6aba6b7ae5cafd65a7feaab492a90439dfa2d04.png)

1. Set this variable from the character construction script as follows:

 ![91761-repro2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/c/f/4cf62103a6faf2b29abfe0fb5ed3f84218738572.png)

1. If you Simulate (Alt+S) and open the ThirdPerson\_AnimBP, you’ll see two instances under Debug Filter:

![91762-repro3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/5/2/a5287e23faeebc0f715ee244e950858b5b7dceec.png)

1. The problem can be also be shown by adding the following nodes to the character event graph:

![91763-repro4.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/6/d/76dcd5f32fb2eb8ecf7dae01d229cd5a76503f57.png)

1. Play the game and move the character. Notice that a speed of zero is always printed on screen. This is because our AnimBP is new instance instead of the character’s instance.

2. The problem does not happen if instead of setting the variable during construction, we set it during Begin Play. Remove the construction script nodes and add the following to the event graph:

 ![91764-repro5.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/8/f/68fca25ad2092f0a17f969e2223f9e29ddf07767.png)

1. Play the game again and see that the speed is now printed properly. So the problem happens with construction script only.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b9532c9a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b9532c9a](https://forums.unrealengine.com/u/anonymous_user_b9532c9a)\
**Post date:** [May 24, 2016, 5:59pm UTC](https://forums.unrealengine.com/t/setting-a-reference-variable-to-the-animbp-in-the-actor-construction-script-creates-a-new-animbp-instance/358377/2 "2016-05-24T17:59:17Z")

</div>

Hi ,

I was able to reproduce this on my end and have entered a bug report, UE-31229, to be assessed by the development staff.

---

<div class="post-metadata">

**Author:** ![emperor\_katax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/emperor_katax/32/1070178_2.png) [@emperor\_katax](https://forums.unrealengine.com/u/emperor_katax)\
**Post date:** [November 3, 2017, 1:47pm UTC](https://forums.unrealengine.com/t/setting-a-reference-variable-to-the-animbp-in-the-actor-construction-script-creates-a-new-animbp-instance/358377/3 "2017-11-03T13:47:33Z")

</div>

… kind of same issue … here are screen shots … seems ThirdPerson\_AnimBP not responding and well it is part of default engine contents … I just add one event there …

here in ThirdPerson\_AnimBP

 ![218959-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/f/1efaac1458886356a6f03fe8914cca2c257effe7.png)

and here in my BP\_Parser blueprint

 ![218960-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/a/c/0ac9ace3e27dfecdfddc31e770bd6a6d3eefd0e7.png)

Can you please let me know if there is any alternative solution for this … ? I Like to play with speed in state machine in “Default” 3rd person character and Event Dispatcher looks like a solution, but it doesn’t work thou…

---

<div class="post-metadata">

**Author:** ![emperor\_katax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/emperor_katax/32/1070178_2.png) [@emperor\_katax](https://forums.unrealengine.com/u/emperor_katax)\
**Post date:** [November 3, 2017, 3:03pm UTC](https://forums.unrealengine.com/t/setting-a-reference-variable-to-the-animbp-in-the-actor-construction-script-creates-a-new-animbp-instance/358377/4 "2017-11-03T15:03:39Z")

</div>

… fixed my issue with this solution … I got mesh from my spawned character and from that mesh, I got Anim Instance and that. was a succeed on Target … Please if you have any suggestions, leave comments… : ) ,

BP\_Parser

 ![218994-3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/e/9/3e94ec9ae715c84ca881da23c56eef4a29d7c829.png)

ThirdPerson\_AnimBP

 ![218995-4.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/b/d/dbd9e76fd2dc756a71338802813c54b863e6b20c.png)

So in result, I can smoothly change between idle and run/walk depends on Speed value which I pass to state machine in ThirdPerson\_AnimBP

---

<div class="post-metadata">

**Author:** ![MrTheRich](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrTheRich](https://forums.unrealengine.com/u/MrTheRich)\
**Post date:** [February 26, 2019, 10:04pm UTC](https://forums.unrealengine.com/t/setting-a-reference-variable-to-the-animbp-in-the-actor-construction-script-creates-a-new-animbp-instance/358377/5 "2019-02-26T22:04:09Z")

</div>

I’m not able to get the node “get anim instance” at all in a construction script. How did you do it? seems like magic to me…
