godotengine / godot

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

Button groups don't work with packed scenes #93559

Open ddel-rio opened 4 months ago

ddel-rio commented 4 months ago

Tested versions

The bug can be reproduced in both the last commit of the master branch (v4.3.beta.custom_build [e78dc83ee]) and in the latest official version of the engine (Godot v4.2.2.stable).

System information

Windows 11 - NVIDIA GeForce RTX 4070 Laptop - Godot v4.2.2.stable - Vulkan(Forward+)

Issue description

Buttons that are a packed scenes do not have the expected behavior if I convert them to toggles and add them to a button group. By pressing them they can be activated but never deactivated.

Steps to reproduce

  1. Converts a button to a packed scene.
  2. Add two or more of those buttons to a scene.
  3. Enable the toggle mode property.
  4. Have them share a button group resource.

Minimal reproduction project (MRP)

mrp.zip

AThousandShips commented 4 months ago

and in the latest official version of the engine (Godot v4.2.1.stable).

The latest official build is 4.2.2, but if it occurs in 4.3 it would likely occur there too

ddel-rio commented 4 months ago

The latest official build is 4.2.2, but if it occurs in 4.3 it would likely occur there too

True, sorry, I tried it in 4.2.2 but I made a mistake when writing the number, I'm going to correct it.

ddel-rio commented 4 months ago

New info: setting the button group in the packed scene instead of externally doesn't work either.

sancho2 commented 4 months ago

You have to select allow_unpress.
Click on the button group, select edit and you will find that option there.
Actually you dont need to select edit, the option is right there when you select the button new button group.

ddel-rio commented 4 months ago

You have to select allow_unpress.

I've already tried. Doing that just makes it work like a normal toggle, but doesn't give me the group benefit of not being able to enable more than one button at a time.

sancho2 commented 4 months ago

I see what you mean now.
I can confirm that when you make a button a scene and instantiate it, it no longer respects the button group or even a new button group and it will not unselect a button when another in the group is pressed.

GODOT v4.2.stable.official [46dc27791]