-
Notifications
You must be signed in to change notification settings - Fork 8
Services
Valk edited this page Oct 4, 2024
·
19 revisions
Important
The service attribute is only valid on scripts that extend from Node.
[Service] // This service will get cleaned up on scene change
public partial class Vignette : ColorRect
{
public void LightPulse() { ... }
}
Vignette vignette = Services.Get<Vignette>();
vignette.LightPulse();
[Service(ServiceLifeTime.Application)] // This service will stay alive forever
public partial class AudioManager : Node
{
public void PlayMusic(AudioStream song) {...}
}
AudioManager audioManager = Services.Get<AudioManager>();
audioManager.PlayMusic(menuTheme);