Tool script not working in editor [Solved]

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By threemi

Hi,

I have a tool script attached to an Area2D and I’m trying to draw a line in the editor as a helper.

When I run the game I can see the line being drawn but in the editor it is not appearing.

Here’s the code:

tool
extends Area2D

func _ready():
set_physics_process(true)

func _physics_process(delta):
	update()

func _draw():
	draw_line(Vector2(), Vector2(20,50), Color(1,1,1), 3)

I tried both, process and physics_process.

Sorry if this was asked before, I couldn’t find the answer.

Any idea?

Thanks

I just tested your codes and works fine for me.
did you restart editor?

volzhs | 2018-03-01 20:50

damn that was it!! restarted the editor and started working just fine. I feel stupid now.
Thanks a lot

threemi | 2018-03-01 20:58

You can also try to close the scene and reopen it

Zylann | 2018-03-01 21:00

:bust_in_silhouette: Reply From: volzhs

You should restart editor once or close and reopen it (as @Zylann said in comment)
You can reload script by File > Soft reload script (Control + Shift + R) for the changes after that.
if it doesn’t work well, I suggest to restart editor or reopen it again.