Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Fido789 |
[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?
I’m not sure if this will help but does calling update_overlays() from the EditorPlugin class work? https://docs.godotengine.org/en/stable/classes/class_editorplugin.html
ChildLearning.Club | 2023-02-22 05:58