Godot Tutorials - Singletons (Autoload)

Описание к видео Godot Tutorials - Singletons (Autoload)

I should mention that it's extremely important that if you need to add communication between nodes that are very displaced in the scene tree (by calling into a global function that emits a signal that the other node is connected to) that you should probably never do it in your main global script. That sort of communication should be avoided when possible, but if necessary, you should create a new singleton specifically to handle that communication to avoid cluttering up your global script with stuff that isn't really global.

Also, there are many other uses for singletons such as scene switching. For this tutorial I just wanted to focus on the code reuse.

Ohh, and the word I was thinking of was "limitations". Inheritance has limitations.

Комментарии

Информация по комментариям в разработке