Make set_script(script)
load script
as a path if script
is a String
#8064
Replies: 3 comments 3 replies
-
Sorry for any grammar mistakes or typos, I'm not a native english speaker |
Beta Was this translation helpful? Give feedback.
-
Unless the path is always absolute, this cannot be done. Besides,
Hey..... godotengine/godot#81734 |
Beta Was this translation helpful? Give feedback.
-
This would create a bit of a confusion as it would be the only place you could do this, and as pointed out in godotengine/godot#81734 this is due to a declaration order thing where |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I recently had to bug fix something in my project and had to get help from the Godot's discord server's #advanced channel. The problem was that
set_script(script)
can take any variable type forscript
, and therefore it could take a String forscript
, so I thought that it internally loaded the script at the pathscript
ifscript
was a StringHowever, that was not the case, and me and the helper wasted some time trying to find the issue, so I suggest that Object's
set_script(script)
loads a script at pathscript
ifscript
's type is a String, for example:set_script("path/to/script.gd")
would now work and set the Object's script to script.gd, as the function now would load that string and then set the script to what was loadedBeta Was this translation helpful? Give feedback.
All reactions