The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Currently, I'm creating a level menu where user should be able to choose the level to play. Nodes hierarchy:

-- Label
-- ScrollContainer
---- VBoxContainer
------ GridContainer1 (easy levels)
------ GridContainer2 (medium levels)
------ GridContainer3 (hard levels)

Each grid container has a bunch of buttons generated from this code:

    private static void SetLevels(in GridContainer container) {
    for (var i = 0; i < 50; i++) {
        var button = new Button {
            Text                = (i + 1).ToString(),
            SizeFlagsHorizontal = (int) SizeFlags.ExpandFill,
            SizeFlagsVertical   = (int) SizeFlags.ExpandFill,
            FocusMode           = FocusModeEnum.None,
            MouseFilter         = MouseFilterEnum.Pass

        button.Set("custom_fonts/font", ButtonFont);

        // Workaround for SetScript weird behaviour. See
        var iId = button.GetInstanceId();
        var completeButton = (Button) GD.InstanceFromId(iId);


And ButtonScript is a simple class with one connection:

internal class LevelButton: Button {
    public override void _Ready() {
        Connect("pressed", this, nameof(OnPressed));

    public void OnPressed() {
        GD.Print($"{Text}: pressed");

The problem is that on a mobile device (Android in my case) I cannot press any level button without high precision. In most cases, my touch will be detected as a scroll event (drag). PC doesn't have such problem.

I've tried to change step and customStep in the VScrollBar instance from ScrollContainer and it works as expected but it doesn't fix my problem.

Godot version v3.3.stable.mono
in Engine by (19 points)

My only guess would be to adjust the scroll_deadzone propery of the ScrollContainer. I would try to set it to something extraordinarily high like your screen size and see if you're still having your problem.

Thanks! This is exactly what I need. I think I misunderstood the scroll_deadzone property.

1 Answer

0 votes
Best answer

As timothybrentwood said, there is a scroll_deadzone (or ScrollDeadzone in C#) property in the ScrollContainer node, which accepts some integer value (probably pixels). It is not documented at all, so it's hard to understand the purpose of this property.

by (19 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.