# UAnimInstance is a nullptr

**URL:** <https://forums.unrealengine.com/t/uaniminstance-is-a-nullptr/600777>\
**Category:** C++\
**Tags:** unreal-engine, UE5-0, CPP\
**Created:** [July 9, 2022, 4:52am UTC](https://forums.unrealengine.com/t/uaniminstance-is-a-nullptr/600777 "2022-07-09T04:52:15Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![peterw1505](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/peterw1505/32/88710_2.png) [@peterw1505](https://forums.unrealengine.com/u/peterw1505)\
**Post date:** [July 10, 2022, 11:01pm UTC](https://forums.unrealengine.com/t/uaniminstance-is-a-nullptr/600777/4 "2022-07-10T23:01:24Z")

</div>

I realized looking at this: [https://forums.unrealengine.com/t/how-can-i-get-skeletal-mesh-animinstance-and-then-cast-it-using-code/283271](https://forums.unrealengine.com/t/how-can-i-get-skeletal-mesh-animinstance-and-then-cast-it-using-code/283271)

that I have to change some code. I did that and it looks better, AnimInstance does not show a NULL anymore:

 ![changedcode](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/3/f/a3f32d67ef3aaa3ed0031659550f4cdef064ccbe.png)

But still when I test play the game, the montage “AM\_Sword” is not played when I attack. Do I need to anything in the animation blueprint? I only created the montage “AM\_Sword”.

---

_[View the full topic](https://forums.unrealengine.com/t/uaniminstance-is-a-nullptr/600777)._
