Reference to spawned objects

Hi, here’s some example: create a bp for the AirCraft Manager:
Add a billboard, which is shown in the level, when you add it (adding one manager only, not checking here, that only one is present, but should be done of course)

This has the AirCrafts Map as variable, which has a string with Flight ID as key, and a reference to the AirCraft actor. In the example, it has 3 functions only:
Add Airplane, Set and Get Pilot Name just for testing…

The aircraft itself is a blueprint as well, in my case this has no mesh, just a name of pilot as Text Variable. (Text is preferred type for all stuff, that should be visible to the player)

For testing, I added the following to my player character.

On Beginplay, just getting a reference to the AircraftManager, that has to be dragged into the level before - you can adjust the billboard with your custom one, here using the default one.

grafik

Now for BeginPlay: here doing the GetAllActorsOfClass only once and store a reference for the manager. Add 2 airplanes with IDs and set pilot names…

For test: On pressing K, using the manager to query information about the Aircrafts, using the Flight ID keys:

No checking done, all hardcoded, only limited functions, but it should make clear the idea.

I hope this is helpful to you

2 Likes