How can i link a spawned actor to an item in a UMG dropdown list?

How can i add a set of runtime spawned actors to a UMG drop down list?

An example would be i am spawning cameras at various locations, but would like to add spawned cameras to the dropdown list and change the view when i select the correponding option on the drop down list

I’ve managed to add an item to the list for each actor spawned and can set the text of the item to say “cam001”,“Cam002” etc etc. But i can seem to link the two. I thought about adding tags as each actor is spawned and then do a check to see if any actor has the tag matching the drop down option and then blend to that view. But i cant get it to work.

Anybody got any thoughts?



I have the next things to think of

  • In widget OnConstruct event just use Get All Actors of Class with ACameraActor param
  • So you have camera list, now let our widget has TMap with FString key and ACameraActor* value
  • Fill combobox options with keys from TMap
  • When user accept his choice you has key to get ACameraActor* from TMap

GetAllActorsOfClass is using HashBuskets which are rather quick. Also, you just do it once when widget is showed and that is not very often. If in this moment you spawn another ACameraActor then you can process it in OnActorSpawned global event