I’m making a game and I’m trying to spawn AI in random points across my nav mesh. I read in some other post that I need to get the nav mesh bounds object I placed in my scene. However, when I try to get it with GetAllActorsOfClass it always returns like 11 different objects, why is that? I only have one Nav mesh bounds volume object.
It looks like it’s finding the same object multiple times! If you’re not changing actors’ names manually those will get generated uniquely, and from what you’re printing out you’re getting the same actor multiple times. Your loop’s internals are flawed meaning you set Navmesh Bounds Variable with every variable. But that’s beside the point. If you have only one volume this is indeed strange GetAllActorsOfClass retrieves more than one. Do you stream any levels in? GetAllActorsOfClass iterates over all actors in the world, so if you have 5 sublevels with NavMeshBoundVolumes, plus one in persistent level, then GetAllActorsOfClass will find all 6 actors.
And if you really care about one specific volume why not reference it directly in the level blueprint? Unless it’s not a level blueprint
I’m not streaming levels. It’s not the Level blueprint, but that’s a great idea, I’ll try that. I set the variable multiple times because I wanted to compare if the object found was the same as the last one. Thus, the print false print true.
Thank you for the answer! I realized this was a silly confusion. There were multiple instances of the blueprint executing that logic, so it was just printing multiple times.