SpawnActor Get data from Other Blueprint without using event

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.

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

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.

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

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

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 …

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?

.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 …?

@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? …

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

indeed …

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.

… give me time … `ll try now …

cast to Character_BP and Class … ?

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

so no need to put Spawner instance on stage

… it works smooth …

… ha ha … that was great ! … many thanks for your attention … now its pretty 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

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

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

Awesome! Consider marking it as resolved.