0 votes

It is stated in the docs that rectposition and rectsize has setters methods setposition and setsize, but when i'm overriding them - they are not being called at all

func _set_size(size: Vector2):
    ._set_size(size)
    get_parent().get_node("Background").rect_size = size
    print_debug("infobox changed size to ", size)

func _set_position(pos: Vector2):
    ._set_position(pos)
    get_parent().get_node("Background").rect_position = pos
    print_debug("infobox changed pos to ", pos)

Calling to set from another script:

func _process(delta):
    $Infobox.rect_position = get_viewport().get_mouse_position()
Godot version 3.2
in Engine by (12 points)

1 Answer

0 votes

You can't override those functions, they're not marked virtual in the docs. Just make your own functions and call them.

by (7,190 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 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 webmaster@godotengine.org with your username.