Godot Version
4.4.1 stable
Question
Hi, I'm working on dynamically adding item into a scene with NavigationRegion2D. I've successfully added item into the first child scene, but when adding item into the second child scene, the item required to have top_level = true in order to see.
I have a scene with 2 child scene. Both these scenes have NavigationRegion2D that have the same config. Root node on both scenes have the same config, no visibility or order config.
Structure of Main Tavern:
Structure of Tavern Basement:
Codes in the Tavern Basement(same in Main Tavern)
extends Node2D
class_name TavernBasement
@onready var navigation_region_2d = $NavigationRegion2D
func _ready() -> void:
TavernManager.on_request_place_furniture.connect(_do_request_place_furniture)
TavernNavigationRegionManager.on_request_rebake.connect(_do_request_rebake)
TavernNavigationRegionManager.request_rebake()
func _do_request_place_furniture(furniture: FurnitureItem, location: Global.Location):
if location != Global.Location.TAVERN_BASEMENT:
return
navigation_region_2d.add_child(furniture)
navigation_region_2d.bake_navigation_polygon()
func _do_request_rebake() -> void:
navigation_region_2d.bake_navigation_polygon()
The issue is, when i _do_request_place_furniture hit in the MainTavern, I can see its added to the navigation_region_2d and displays and got rebaked, basically works as normal. But if I move down to the Basement and try to place an item there, the _do_request_place_furniture also triggered and do the entire logic correctly. But I cant see it in the game, unless i use this furniture.top_level = true. The issue might not even related to NavigationRegion2D because i have tried adding the item to the root node(TavernBasement), but it still doesn’t show
I’m not sure what the issue is because both of these scene share the same code but it works for the first node in the tree. I tried to recreated everything from scratch but still same issue. Anyone can help me identify the issue or did i config something wrong ?


