godotengine / godotengine/godot
Control Node jumps to right by screen width when building the game
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Produced in both 4.2.1 and 4.3d4 Mono versions
### System information
Godot v4.2.1.stable.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (NVIDIA; 31.0.15.5152) - AMD Ryzen 5 3500X 6-Core Processor (6 Threads)
### Issue description
I have structure like this.
MainScene (2D Node) -> Canvas Layer -> [ Control -> Panel ]
Brackets part above is a scene of its own, and has other unrelated nodes both under the Control and Panel nodes.
When I'm in the control scene and change Panel position and anchor it to top right and start the game, no problems occur. When I change the scene to the main one and then I start the game, position for the panel changes. (position in the control .tscn file changes as soon as I hit F5)
This change is always in the X axis, and is the width of the default viewport width I set in the project settings, in my case 628px.
I have my AnimationTree that controls only the size of the panel, but I disabled it just in case. Still the same.
[Here is a video of the problem](https://youtu.be/KmJ1t5wInMs)
**Update:** I found out that the problem was actually caused by the animations, even if my AnimationTree is disabled. Problem still persists of course, for some reason. I just tried recreating the same panel from beginning, everything was working until I made the collapse animation, which only changes the size property of the panel. When I created this animation, panel started jumping again.
I added position, anchor and other properties I tought my be the problem to the RESET track, nothing changed. Still the same problem.
### Steps to reproduce
I could not produced the problem when I created a new project with the same version. So I'll just leave the repository for the project, which is really small as I just began. Just clone the repo, go to prefabs/WorldGenUI.tscn, move the "PlayerInfoBox" to top right if jumped again, then go to scenes/MainScene.tscn, hit F5 and you'll see.
### Minimal reproduction project (MRP)
[Direct link to the project files](https://github.com/godotengine/godot/files/14593295/Godot.UI.bug.project.MRP.zip)
Contributor guide
Research direction
Use the linked MRP first: inspect prefabs/WorldGenUI.tscn and scenes/MainScene.tscn, then reproduce the jump by moving PlayerInfoBox to the top right and running F5. Compare behavior with the collapse animation enabled and disabled, focusing on the Panel size animation and its RESET track. Done means identifying why the panel shifts by the viewport width and preventing that shift when instanced from MainScene.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100