Suppose I have two nodes like below:
Node2D (with exported ImageTexture)
and I did some job to do like below:
when: Node2D.ImageTexture is changed **in editor**
→ Change TextureFrame.texture to have same texture
for this I changed my script to have tool keyword on top of my script, but the problem is...
After struggling with various bugs what I've made I found there's no way to determine whether the script is running in editor or exported game. Because the script is originally created for in-game behavior of moving Node2D, Saved project would have changed position of that Node2D which will be modified on editing, Which will cause modified .tscn scene file when I changed nothing of my scene at all, then Git will blame me to commit changed position of Node2D,,,
Yes, In short I'm mixing tool script and in-game script in one GDScript file, therefore I need to determine the script is running on editor or not, as same as Question title says.
Is there an way to detect whether a script is running on the editor or on a exported game? Thanks a lot!
 which is actually CanvasLayer but That's not important in this case