godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.46k stars 21.07k forks source link

Gridmap shows after reload_current_scene() if hidden in editor #81000

Closed elvisish closed 1 year ago

elvisish commented 1 year ago

Godot version

3.5.2 RC2

System information

Windows 10

Issue description

If a gridmap is hidden in the editor and get_tree().reload_current_scene() is used, the gridmap will reappear on reset. Using hide() or visible = false in _ready() will not work: image

The only fix is to use: image

func _ready():
    show()
    hide()

Steps to reproduce

Minimal reproduction project

brokenhideshow.zip

Sch1nken commented 1 year ago

Can confirm in 3.5.2 Stable and 4.1.1 Stable under Linux (X11).

Edit: Upon further research I found the following: The visibility of the GridMap itself never changed (still hidden after reload). But the single meshes in the cells are probably set to "visible" by default.

Probably fix: Upon instantiation of the meshes inside a GridMap, check if the GridMap itself is even visible.