-
Couldn't load subscription status.
- Fork 10
Services
Valk edited this page Aug 4, 2025
·
25 revisions
Important
The service attribute is only valid on scripts that extend from Node and the node must be in the scene tree.
// Services assume there will only ever be one instance of this script.
// All services get cleaned up on scene change.
public partial class Vignette : ColorRect
{
public void LightPulse() { ... }
// Use _EnterTree() if the service is not being registered soon enough
public override void _Ready()
{
Services.Register(this);
}
}// Get the service from anywhere in your code
Vignette vignette = Services.Get<Vignette>();
vignette.LightPulse();