# SpawnActor Get data from Other Blueprint without using event

**URL:** <https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879>\
**Category:** Blueprint\
**Tags:** spawn, get-all-actors-from-, unreal-engine, Blueprint, question\
**Created:** [November 6, 2017, 3:33pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879 "2017-11-06T15:33:30Z")\
**Posts on this page:** 14\
**Page:** 1

<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 6, 2017, 3:33pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/1 "2017-11-06T15:33:30Z")

</div>

Here is my approach for solving issue. Please feel free to add any comments or suggestions. … ; ]

1- Assume you have a **Spawner blueprint class**. This class make numbers of SpawnActors at **runtime**. Each Actor has a “ **Public Blueprint variable** ” named **ID** , which will assign to a number at “Spawn” time. Also, this class continuously generate random numbers on Tick and assign it to its public variable which is **ID**.

So in short, it Spawns couple of Actors with ID and has a random number generator on Tick event.

 ![219280-12.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/8/d/08dd432978386bd2bbe3ea2b65cf72c29814af67.png)

2- You need to add this class (spawner) to stage from editor. It **should** be there before running game.

 ![219294-16.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/9/9c98f06957f29336a50dccf4c190ecfbe9a3ae58.jpeg)

3- In Actor class (which you are going to spawn), you need to use “ **Get All Actors of Class** ” on Tick and get your Spawner blueprint and put result in an array. It will be just one because you add just one spawner to stage. From that array simply get the first element and easy use public variable of your Spawner which is **ID** ,.  
you can use this in scenario like, if that random number matches with the ID of you Actor, then you can play some functions thou.

 ![219292-14.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/e/b/feb6c587f8a381e35ae157c73522206185181108.png)

In this approach you don’t need to use ANY event dispatcher.

---

<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:** [November 6, 2017, 3:42pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/2 "2017-11-06T15:42:47Z")

</div>

What’s wrong with Event Dispatchers? Why go through all this? Honest question.

If you’re going through all this, you might as well create the spawner in the GameInstance which the LevelBlueprint (and everything else) can access.

Also, this is not a question, right? You’re just sharing your experiences?

> In Actor class (which you are going to  
> spawn), you need to use “Get All  
> Actors of Class” on Tick and get your  
> Spawner blueprint and put result in an  
> array.

Why? This is truly baffling. _GetAllActorsOfClass_ is generally a bad idea, used in Tick is pretty weird.

Sorry, not getting any of this XD

---

<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 6, 2017, 3:52pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/3 "2017-11-06T15:52:26Z")

</div>

well , yes, this is just my experience … I try to use event dispatcher from Level Blueprint , but no luck … the Actore class is a pawn with one sphere and as you see just a skeleton mesh… I agree with you, Tick is not ok …  
How to make it by event dispatcher… ? , I go through many posts and well, they didn’t match to my case …

---

<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:** [November 6, 2017, 4:10pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/4 "2017-11-06T16:10:16Z")

</div>

So what are you trying to do, precisely?

Do you want an actor that you’ve placed in the level blueprint communicate with an actor spawned at run time?

---

<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 6, 2017, 4:20pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/5 "2017-11-06T16:20:41Z")

</div>

.dude, many thanks for your attentions … : ) ,  
…I have a JSON stream which continuously send me data. I simulate that random data with a C++ class from Actor. Then made a blueprint out of it and spawned 2 Characters on stage and also gave them an ID as you see…now, I want them to get that random streaming data from my spawner class …  
How you role this with event dispatcher? …  
… I tried many ways but it doesn’t give me a source/reference/object to Bind that event in Spawned objects … or maybe I miss something here thou …

in C++ we can assign DELEGATES in game mode and it does the job , but … how in Blueprint …?

---

<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 6, 2017, 4:52pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/6 "2017-11-06T16:52:01Z")

</div>

@Everynone … a good update on my blueprint , is to have a reference of spawner , get read of Get All Actrs and directly get BroadCast Value out of it on Tick … but how I reach to such a reference to spawner? …

---

<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 6, 2017, 5:08pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/7 "2017-11-06T17:08:49Z")

</div>

… this is an interesting solution for getting reference, but meet coding …

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

indeed …

> **[How create global variable?](https://forums.unrealengine.com/questions/61356/how-create-global-variable.html)**
>
> Hi. How can I create variable whom I can edit from differents blueprints, and then using her in another blueprints?

---

<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:** [November 6, 2017, 5:12pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/8 "2017-11-06T17:12:33Z")

</div>

In the _GameMode_, create a reference to your spawner - it will be null at the moment.

Place the spawner in the Level, as you did. In BeginPlay (still level blueprint), Get GameMode → Cast to the extended class → set the Spawner reference to the object.

You can, of course, spawn the spawner dynamically, too, working around the LevelBlueprint shenanigans altogether.

---

<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 6, 2017, 5:15pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/9 "2017-11-06T17:15:23Z")

</div>

… give me time … `ll try now …

---

<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 6, 2017, 5:26pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/10 "2017-11-06T17:26:40Z")

</div>

cast to Character\_BP and Class … ?

 ![219308-18.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/f/7af042e66d46800dc62036022d831727ca6203c0.png)

 ![219309-19.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/1/b/e1b9920b76d75a8d4de213229ed8267a014251ed.png)

---

<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:** [November 6, 2017, 6:15pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/11 "2017-11-06T18:15:27Z")

</div>

I thought you wanted your spawner placed in the level blueprint…

 ![219317-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/2/4f2c25748a8012040b08b5be8b21ec91bf053558.png)

edit: when I said ‘cast to class’ I meant your extended game mode, sorry for the confusion, my bad

---

<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 6, 2017, 6:27pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/12 "2017-11-06T18:27:36Z")

</div>

… dude, I reach to other solution … I will try yours now …

 ![219318-22.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/e/8/0e863a8722beb757567ae45c4cfcd2971a25a9b8.png)

so no need to put Spawner instance on stage

 ![219319-24.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/3/6/736cff6372c0302a1e8e68bd496ac3d7bfb985fb.png)

… it works smooth …

---

<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 6, 2017, 7:12pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/13 "2017-11-06T19:12:27Z")

</div>

… ha ha … that was great ! … many thanks for your attention … now it works without using events … it doesn’t mean I don’t like events, but this way will be less expensive on cpu and user local machine thou … specially on mobiles … ; ] , 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:** [November 6, 2017, 7:20pm UTC](https://forums.unrealengine.com/t/spawnactor-get-data-from-other-blueprint-without-using-event/408879/14 "2017-11-06T19:20:42Z")

</div>

Awesome! Consider marking it as resolved.
