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")
asked May 17 in Engine by chanon (182 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.

answered May 17 by Calinou (2,600 points)
selected May 20 by chanon
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 How to use this Q&A? before posting your first questions.