0 votes

I am looking for my tool, for the equivalent of get_current_script() but to get the text from a .txt file instead of a gd file. Something like a TextEditor. But it is not available/exposed in gdscript. TextEdit does not provide a reference to the Editor interface.

tool extends EditorPlugin

var ef = EditorPlugin.new().get_editor_interface()
var se:ScriptEditor = ef.get_script_editor()
var sc:Script = se.get_current_script()
print(sc.source_code)
Godot version 3.5 stable
in Engine by (805 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 Frequently asked questions and 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 [email protected] with your username.