SpawnActor Get data from Other Blueprint without using event

Cliff Sharif
Mon, 06 Nov 2017 15:33:30 +0000
Blueprint

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.

14 posts - 1 participant