0 votes

The documentation here:
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 (174 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 6 days ago by Calinou (1,947 points)
selected 4 days ago 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.