godotengine / godotengine/godot
NOTIFICATION_APPLICATION_FOCUS_IN and NOTIFICATION_APPLICATION_FOCUS_OUT Cause Engine Freeze/Stutter with Large Scene Trees
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
4.3, 4.2.2, 4.1.3, 4.0
### System information
Godot v4.3.stable.mono (97f0c76f2) - Ubuntu 24.04.1 LTS 24.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2080 Ti (nvidia; 560.35.03) - AMD Ryzen 9 3900X 12-Core Processor (24 Threads)
### Issue description
When the `NOTIFICATION_APPLICATION_FOCUS_IN` and `NOTIFICATION_APPLICATION_FOCUS_OUT` notifications are triggered, the Godot engine freezes or stutters noticeably if there are many nodes in the scene tree. This issue affects the engine's performance, especially in scenes with large hierarchies.
### Steps to reproduce
1. Create or open a project with a scene that contains a large number of nodes in the scene tree.
2. Run the project.
3. Switch the application focus away from the engine (e.g., by clicking on another window).
4. Switch the application focus back to the engine.
5. Observe the engine's performance during these focus changes.
### Minimal reproduction project (MRP)
[MRP.zip](https://github.com/user-attachments/files/17609013/MRP.zip)
Contributor guide
Research direction
Start with the attached MRP.zip and reproduce the freeze or stutter while switching focus away from and back to the engine. Trace the handling of NOTIFICATION_APPLICATION_FOCUS_IN and NOTIFICATION_APPLICATION_FOCUS_OUT with a large scene tree, then verify that focus changes no longer cause noticeable performance degradation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, godot
- Domain
- game-dev, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100