From df5a2ef6cb8903c86187cc93ee1d454c85ffbff5 Mon Sep 17 00:00:00 2001 From: Louis Poirier Date: Mon, 24 Jun 2024 18:28:05 +0200 Subject: [PATCH] Update wiki to add a note about ScriptableService Explain how to get a ScriptableService, when class is declared in a module, with an example. --- wiki/Home.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wiki/Home.md b/wiki/Home.md index 3c5fa3b6..a8d17546 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -34,6 +34,18 @@ Service instance can be accessed using service container: let myService = GameInstance.GetScriptableServiceContainer().GetService(n"MyService") as MyService; ``` +**Note:** if you declare `MyService` in a module, you must include the full path of the module to get the service: + +```swift +module MyModule.Services + +class MyService extends ScriptableService { + // ... +} + +let myService = GameInstance.GetScriptableServiceContainer().GetService(n"MyModule.Services.MyService") as MyService; +``` + Service properties marked as `persistent` will keep their state forever. Unlike scriptable systems, service state storage is not tied to save files.