# Casting not working

**URL:** <https://forums.unrealengine.com/t/casting-not-working/406797>\
**Category:** Blueprint\
**Tags:** casting, cast-failed, cast-to, unreal-engine, question, Blueprint\
**Created:** [October 11, 2017, 11:44pm UTC](https://forums.unrealengine.com/t/casting-not-working/406797 "2017-10-11T23:44:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![guidocm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@guidocm](https://forums.unrealengine.com/u/guidocm)\
**Post date:** [October 11, 2017, 11:44pm UTC](https://forums.unrealengine.com/t/casting-not-working/406797/1 "2017-10-11T23:44:32Z")

</div>

I’m trying to play a sound attached to an actor Cube, that is in the scene, from another blueprint when the player jumps. While “Get All Actors of Class” did the job I’d like to make it more efficient since I already know that I just want to play that particular sound, on that Cube. So I thought about casting… This is what I’ve got so far but I can’t realize how to get a reference to that Cube in order to pin it to the Object input.

 ![216399-image-2017-10-11-at-83824-pm.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/f/1/2f1afb0285abedec0e5582725f4df8b0bb7e2f6f.png)

By the way, this is the Custom Event that I’m referencing to

![216400-image-2017-10-11-at-83924-pm.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/2/c/92c5a8559ef7d849f375e20a8eadb0591cdfc0a9.png)

Any ideas?

---

<div class="post-metadata">

**Author:** ![guidocm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@guidocm](https://forums.unrealengine.com/u/guidocm)\
**Post date:** [October 12, 2017, 1:09am UTC](https://forums.unrealengine.com/t/casting-not-working/406797/2 "2017-10-12T01:09:46Z")

</div>

I created an Actor variable, pinned it to the Cast node and it worked! Could we say that this is a proper approach to do something like this?

This is how it ended up being:

 ![216416-image-2017-10-11-at-100658-pm.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/9/7/d9717726ab7d816cd14baaf5b0e9db64b9abae67.png)

---

<div class="post-metadata">

**Author:** ![wibu-games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@wibu-games](https://forums.unrealengine.com/u/wibu-games)\
**Post date:** [November 24, 2017, 9:02pm UTC](https://forums.unrealengine.com/t/casting-not-working/406797/3 "2017-11-24T21:02:30Z")

</div>

You dont have an object atached to the cast, it will always fail, you should get a reference of the cube you want to play the sound on and atach it there

---

<div class="post-metadata">

**Author:** ![guidocm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@guidocm](https://forums.unrealengine.com/u/guidocm)\
**Post date:** [November 24, 2017, 9:05pm UTC](https://forums.unrealengine.com/t/casting-not-working/406797/4 "2017-11-24T21:05:22Z")

</div>

Yes, I know that but my question is: How could I get that reference, other than “Get all actors of class”?

---

<div class="post-metadata">

**Author:** ![Nachtmahr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nachtmahr](https://forums.unrealengine.com/u/Nachtmahr)\
**Post date:** [November 24, 2017, 10:59pm UTC](https://forums.unrealengine.com/t/casting-not-working/406797/5 "2017-11-24T22:59:24Z")

</div>

Watch this and you will be set [Blueprint Communications | Live Training | Unreal Engine - YouTube](https://www.youtube.com/watch?v=EM_HYqQdToE)
