+1 vote


I have project with several different separate maps, each of them has Navigation2D node with Tilemap as a child, and tiles have Navpolygons attached to them.

When i just load the scene from disk and instance it like that:

new_scene = ResourceLoader.load(path).instance()

Everything is fine, and get_simple_path on enemies works correctly.
When player leaves the scene it is removed from the tree and saved in the dictionary so i can load it when player returns to it.
And this works correctly for everything( like positions of enemies, items player picked up etc )
But get_simple_path in enemies returns empty array, like navigation polygon no longer exists.
I tried to figure out what exactly happens and honestly i do not quite get it but if i write code like this

   new_scene = ResourceLoader.load(path).instance()
   var child=get_tree().get_root().get_node("root/level/room")
   var parent=get_tree().get_root().get_node("root/level")

Basically if just remove my level from tree and immediately add it again it will break navigation.
Is there something i don't understand about how tilemap navigation works?
If use just regular Navpolygon directly in the level it does not disappear of course.

I fiddled a little more and added a button that deletes random cell in the TileMap.
If you do that than navigation starts to work, but not really, it is like only Half of the navigation polygon works, but if you delete more cells it sometimes starts to work completely. It is easier to understand if you see the project attached.

in Engine by (15 points)
edited by

Maybe that's a bug, do you have a minimal repro project?
Do you see any error in the system console?

A little minimalistic but it shows the issue:
If you just load the room initially and click anywhere it gets points with get_simple path
but if you then "reload" room get_simple path will always return empty array.

Maybe something is happening in navigation or tileset on _enter_tree() or _exit_tree()?

OK, i searched for similar issues and they all not quite what is happening to me.
It is like Navigation polygon just disappears.

Only clue, after some testing is that if NavPolygons overlap in a weird way, (like if i extend it slightly beyond tile borders) get_simple path will also return empty array, but only with some coordinates combinations, with some it will still return path.

Everything would be much easier if i somehow would be able to Visualize navigation polygon, but from what i can understand you really cannot.

Sadly i cannot really read source code that well but i really want to know what is happening, like is it a bug? Or am i just stupid?

I also tried for the heck of it to do the same thing in 3.0 and same thing happens.

Here is minimal working example(not in 3.0):

I have the exact same issue in my project. This only seems to affect NavPolygons in TileMaps.

You should post your issue on Github.
It sounds similar to https://github.com/godotengine/godot/issues/11077 though, but the repro is different

I went ahead and made a github issue.

You can find it here:


Thanks, i was going to submit an issue eventually, but just decided to wait a little to see if anyone had the same problem.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.