Skip to content

Commit

Permalink
Fix "Setup navigation" removing Terrain3D children
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Dec 21, 2024
1 parent 8ebd163 commit a17b740
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions project/addons/terrain_3d/src/baker.gd
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,8 @@ func _do_set_up_navigation(p_nav_region: NavigationRegion3D, p_terrain: Terrain3
var index: int = p_terrain.get_index()
var t_owner: Node = p_terrain.owner

parent.remove_child(p_terrain)
p_nav_region.add_child(p_terrain)

parent.add_child(p_nav_region, true)
p_terrain.reparent(p_nav_region)
parent.move_child(p_nav_region, index)

p_nav_region.owner = t_owner
Expand All @@ -391,10 +389,8 @@ func _undo_set_up_navigation(p_nav_region: NavigationRegion3D, p_terrain: Terrai
var index: int = p_nav_region.get_index()
var t_owner: Node = p_nav_region.get_owner()

p_terrain.reparent(parent)
parent.remove_child(p_nav_region)
p_nav_region.remove_child(p_terrain)

parent.add_child(p_terrain, true)
parent.move_child(p_terrain, index)

p_terrain.owner = t_owner

0 comments on commit a17b740

Please sign in to comment.