How to make AI spawn buildings correctly? (I have my own solution but its just bad)

Your solution almost works, I mean the AI does look into different places to build the building and even builds the default buildin however :


I cannot get the building to build from the ai ( the AI is set in blueprint TownHall) here in the picture above I finally got it to somewhat work, I mean I get the townhall itself but for some reason the BuildingToBuild variable always comes out as NULL… it feels like the “begin play” in ghost building starts before the townhalls BuildingToBuild is set? Even though townhall exists the moment you start playing the game? Or mayby Im getting something wrong… I tried using Cast To but with same result (although I can barely understand how it works…) and I tried using interfaces but again with the same result.

  1. this is what ghost building receives from town hall
  2. unreal tells me its null
  3. this is proof that I indeed got the town hall blueprint
  4. this is supposed to give me the name of the building to build but because the refference doesnt exist it spits nothing…

This is the Town hall BP where the information about building to build is set (nr 3 in output log)

I dont know what Im doing wrong but Im fighiting with it for a while now and it drives me crazy… If I set the building to build to a specific building in the ghost it works perfectly fine but I just cant get the correct building from the AI to be set in the ghost :frowning: