This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

The documentation here:
http://docs.godotengine.org/en/3.0/development/cpp/object_class.html#registering-an-object
shows how to bind methods on a new Object class.

I'm wondering if it is possible to bind new top level functions. For example, if I wanted a new custom print function called myprint that I could use in GDScript like

myprint("some text")
in Engine by (262 points)

1 Answer

+1 vote
Best answer

GDScript does not support global variables or functions, but you can create singletons which let you define variables and functions that can be used anywhere. See Singletons (AutoLoad) in the documentation.

It is also possible to load entire scenes (and not just scripts) this way.

by (12,908 points)
selected by
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.