Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

NavMesh Bounds Repeated?

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.

Here's the logic:

alt text

alt text

And here is the result:

alt text

Any idea why this happens? It looks like it's finding 11 different objects

Product Version: UE 4.12
navmeshq1.png (100.2 kB)
navmeshq2.png (112.0 kB)
navmeshq3.png (868.5 kB)
more ▼

asked Oct 05 '16 at 01:27 AM in Blueprint Scripting

avatar image

620 17 10 34

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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 :D



more ▼

answered Oct 07 '16 at 02:34 PM

avatar image

MieszkoZ STAFF
7.4k 225 57 415

avatar image MacDx Oct 07 '16 at 04:14 PM

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.

avatar image MieszkoZ STAFF Oct 07 '16 at 04:49 PM

This is actually really interesting. If you cared enough to make a repro project with this issue I'd have a look.

avatar image MacDx Oct 07 '16 at 05:09 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You may want to add an IsValid check in there too.

more ▼

answered Oct 07 '16 at 04:57 PM

avatar image

91 5 9 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question