ediweber
ediweber

Reputation: 3

Invalid set index 'rect_min_size' (on base: 'Button') with value of type 'Vector2'. GODOT

GODOT version v4.2.1.stable.official [b09f793f5]

my code:

# Dieses Skript verwaltet den Hauptbereich mit dem 16x16 Raster.
extends Control

func _ready():
    # Erstelle ein 16x16 Raster aus quadratischen Kacheln.
    for x in range(16):
        for y in range(16):
            var kachel = Button.new() # Verwendung von Buttons als Platzhalter für Kacheln
            kachel.rect_min_size = Vector2(40, 40) # Korrekte Zuweisung der Größe als Vector2
            kachel.rect_position = Vector2(x * 40, y * 40) # Positionierung der Kachel
            add_child(kachel)

somehow I cannot get that running. Anyone able to help? Documentation says that rect_min_size is of type Vector2, so I don't see the thing which I don't see. I am obviously missing something here...

HELP!!!

already tried stupid stuff like doing things like: var a=Vector2(40,40) kachel.rect_min_size = a same error ;-)

Upvotes: 0

Views: 616

Answers (2)

Theraot
Theraot

Reputation: 40295

The property rect_min_size existed in Godot 3 but not in Godot 4.

You might be able to set custom_minimum_size in Godot 4. However, make sure that you do not want to set size instead.

If you are using the online documentation, you can see the version of Godot for which you are reading the documentation in the bottom left, and also in the URL.

Upvotes: 0

SilicDev
SilicDev

Reputation: 354

In Godot 4 the property is called custom_minimum_size. rect_position should also be just position.

I'd recommend using the built-in Documentation to find these kind of things in the future, or hovering over the property you want to change in the inspector as it shows the name of the variable in the tooltip.

Upvotes: 0

Related Questions