Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Released project has a chance of crashing with Camera2D and a large TileMap upon reload_current_scene #75413

Open
fiaKaiera opened this issue Mar 28, 2023 · 3 comments

Comments

@fiaKaiera
Copy link

fiaKaiera commented Mar 28, 2023

Godot version

v4.0.1.stable.official [cacf499]

System information

Windows 10 64-bit

Issue description

In an exported Release file on Godot, if a TileMap node has a large number of tiles present in the scene, and a Camera2D node is present, upon calling get_tree().reload_current_scene(), the game has a chance of crashing without any errors, which can scale by the number of tiles present in the scene.

The game will not crash at all if get_tree().reload_current_scene() is called in debug mode.
This bug is not present in Godot 3.

Edit/Update:
The same outcome can be achieved if the Camera2D node is added after the scene is reloaded.
A workaround fix for this is having the Camera2D node exist outside the current scene.

The conditions for the bug:

  • Running the game as a Release (not in debug)
  • A Camera2D node is present
  • A TileMap node is filled with a large number of tiles placed
  • get_tree().reload_current_scene() is called

Expected outcome:

  • get_tree().reload_current_scene() is called
  • Game works as intended with no crashes

Current behavior:

  • get_tree().reload_current_scene() is called
  • There will always be a non-zero chance of the game crashing once called
  • Otherwise, the game will continue normally until get_tree().reload_current_scene() is called again

There are no errors and nothing is reported upon crashing in both the editor and on the released game with the verbose console option enabled.

Steps to reproduce

  • Create a Node2D scene
  • Create a TileMap in the scene
  • Assign the TileMap with a large number of tiles
  • Add a Camera2D node
  • Add a function anywhere that can call get_tree().reload_current_scene()
  • Save the scene, assign the current scene as the Main Scene
  • Export the project as Release
  • Run the released program and call get_tree().reload_current_scene()

Minimal reproduction project

The provided project has a script that automatically runs get_tree().reload_current_scene() every 0.2 seconds, with the provided scene given to easily replicate the crash once exported.

Godot4TilemapTest.zip

@Calinou
Copy link
Member

Calinou commented Mar 28, 2023

Can you reproduce this when exporting the project with debugging enabled?

@fiaKaiera
Copy link
Author

No, the crash does not happen at all when exported with debugging enabled.

@Lilith-In-Starlight
Copy link

Lilith-In-Starlight commented Jul 20, 2023

Doesn't happen only with tiles, a large amount of Sprite2D nodes apparently suffices for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants