# How to Cast an actor from another actor

**URL:** <https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4, UE4-27, Blueprint, question\
**Created:** [March 6, 2022, 4:28pm UTC](https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482 "2022-03-06T16:28:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Selviniah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Selviniah](https://forums.unrealengine.com/u/Selviniah)\
**Post date:** [March 6, 2022, 4:28pm UTC](https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482/1 "2022-03-06T16:28:12Z")

</div>

> If I use direct reference method, I can access an int number but its giving error and if I setup a simple function that ascends 100 cm height, I cannot do it.

This is my first actor There is only a cube inside there is nothing more

 ![1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/d/9dddfa6474f72dc83e0d70e9d8dd5c8bca0c543b.jpeg)

And this is my second cube. I direct referenced FirstActor. and only wanted to set new location like my question and your answer.

 ![2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/1/5/c158684cc226e28332185445afea546310dec8a7.png)

When I hit play I cannot see the function is worked and I get this error

 ![3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/3/8/0383b9c76eb0dc17a9200a4a6b67cce03794fb99.png)

The solution is very important to me. I would be very happy if you solve my problem. Because of this, I cannot advance in my own project and I feel something is very easy and I am missing that piece

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 4:55pm UTC](https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482/2 "2022-03-06T16:55:56Z")

</div>

> [@Selviniah](#):
>
> All I want to hear is, whether I have an option to connect object input in cast to or simply I cannot do it and I have to do it through character or with blueprint outputs. It is important to know if it is possible because I spent lots of time to make a solution

Please explain how those 2 actors get into the game:

- did you place them in the level - scene
- do you spawn them from class (if so which blueprint does it)

---

<div class="post-metadata">

**Author:** ![Selviniah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Selviniah](https://forums.unrealengine.com/u/Selviniah)\
**Post date:** [March 6, 2022, 4:58pm UTC](https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482/3 "2022-03-06T16:58:23Z")

</div>

They are in scene just that. I didn’t spawn and I didn’t used level blueprint.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 5:02pm UTC](https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482/4 "2022-03-06T17:02:29Z")

</div>

In the blueprint that needs to talk the _other_ blueprint create a reference of the type of the _other_ blueprint.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/6/e/96e04f6d5499b45cc1837b1940852d439027888c.png)

Above, this actor will try to talk to the aMover. Below, you can now choose an instance from the scene this instance will talk to:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/d/3cd4095dc0307dee4600e39a1b5e198c8027c887.jpeg)

Or use the ~~pipette~~ _EYE DROPPER_ to select it directly. There would be no need to cast.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/7/0/87088d2f699b5a35274bd03f5491a60bdf77a1f7.png)

You now have a direct reference.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 5:09pm UTC](https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482/5 "2022-03-06T17:09:06Z")

</div>

If in doubt, head over here:

> **[Referencing Actors](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/ReferenceAssets/)**
>
> A How To Guide for Referencing Actors in Unreal Engine 4.

And start reading up from this point:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/6/7/c67e16b1b1abef3efdb1c21c66cb5784474d32e0.png)

Same thing as I suggested but explained better, in more detail.

---

<div class="post-metadata">

**Author:** ![Selviniah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Selviniah](https://forums.unrealengine.com/u/Selviniah)\
**Post date:** [March 6, 2022, 6:02pm UTC](https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482/6 "2022-03-06T18:02:07Z")

</div>

> If I use direct reference method, I can access an int number but its giving error and if I setup a simple function that ascends 100 cm height, I cannot do it.

This is my first actor There is only a cube inside there is nothing more

 ![1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/d/9dddfa6474f72dc83e0d70e9d8dd5c8bca0c543b.jpeg)

And this is my second cube. I direct referenced FirstActor. and only wanted to set new location like my question and your answer.

 ![2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/1/5/c158684cc226e28332185445afea546310dec8a7.png)

When I hit play I cannot see the function is worked and I get this error

 ![3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/3/8/0383b9c76eb0dc17a9200a4a6b67cce03794fb99.png)

The solution is very important to me. I would be very happy if you solve my problem. Because of this, I cannot advance in my own project and I feel something is very easy and I am missing that piece

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 6:37pm UTC](https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482/7 "2022-03-06T18:37:11Z")

</div>

Follow the steps I described. Show us how you assign the reference from the scene - 2nd pic in my example.

It seems you did not do it, hence the Accessed None error.

---

<div class="post-metadata">

**Author:** ![Selviniah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Selviniah](https://forums.unrealengine.com/u/Selviniah)\
**Post date:** [March 6, 2022, 8:30pm UTC](https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482/8 "2022-03-06T20:30:40Z")

</div>

Hey, I am very happy to say it works. From now on, I won’t use level blueprint or character blueprint for such these small details. Thank you.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 8:35pm UTC](https://forums.unrealengine.com/t/how-to-cast-an-actor-from-another-actor/504482/9 "2022-03-06T20:35:13Z")

</div>

> [@Selviniah](#):
>
> I won’t use level blueprint or character blueprint for such these small details.

Technically it’s not a bad idea to _glue_ actors together using the LB and dispatchers. Have a look at his example:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/d/9dd56ca9d5b9a4843a92c21a86517b20af09bc44.png)

In this thread:

> [@Event dispatcher between 2 blueprints](https://forums.unrealengine.com/t/event-dispatcher-between-2-blueprints/116301/3):
>
> Currently you do not have a problem with Dispatchers. You have a problem with passing object references - your missing pin. [HR][/HR] Since you have both objects in the Level Blueprint, you can use the LB as glue between them. Consider the following: Actor A has an Event Dispatcher happy to send the data to whoever is listening: [ActorA.PNG] Actor B has a Custom Event that is waiting for that data: [ActorB.PNG] Currently those 2 objects do not know about one another’s existence. But the Le…

* * *

Sometimes you may want actors to talk without them knowing about one another. Avoiding direct hard references can be beneficial. Imagine what happens if one of the actors gets destroyed, for example - the editor will throw errors at you again.

Using the above method would avoid that.
