+1 vote
[Tool]
public class Level : Node2D
{
    [Export]
    public int FinishPosition;

    public override void _Draw()
    {
        if (Engine.EditorHint)
        {
            DrawRect(new Rect2(0, -540, FinishPosition, 1080), Color.Color8(255, 0, 0), false);
        }
    }
}

Hello!

The code above draws a red rectangle in editor. The rectangle is as wide as FinishPosition script variable. It works fine, however after FinishPosition is updated I have to close and reopen the scene to reflect the changes and actually resize the rectangle.

So I would like to ask you, is there a way to "refresh" the rectangle right after the FinishPosition is updated in inspector without need for reopening the scene?

Godot version 3.4.2
in Engine by (13 points)

Please log in or register to answer this question.

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.