Category : 10. Advanced

Global Services Typically you can register a global service simply by adding the [Service] attribute directly to type of the service: [Service] public class SomeService { } Sometimes, however, you might want to create services from types defined inside third-party assets, in which case making any modifications to their source code could be out of ..

Read more

The Preload Scene (also known as the Boostrap Scene) is a technique where you always launch your game from the same scene. This enables you, among other things, to place important global services into this scene, and ensure that they are always loaded before any other scene objects in the game. One big pain point ..

Read more

Sometimes you might need to inject a different instance of the same service to every client that requests the service. This can be achieved in Init(args) using value providers: Create a class that implements IValueProvider<T>, where T is the concrete or defining type of your service. Implement IValueProvider<T>.Value in such a way, that a new ..

Read more

Types that contain generic type parameters can also be registered as global services by adding the [Service] attribute to them: using Sisus.Init; [Service] public class Logger<T> { public void Info(string message) => Debug.Log(typeof(T).Name + ” – ” + message); } When this is done, no instance of the global service is created automatically during initialization ..

Read more

Init(args) has built-in support for the Entity Component System (ECS). Systems You can register a system as a global service by adding the [Service] attribute to its type. This makes it possible for clients – including all other services that have the [Service] attribute – to receive the system automatically during their initialization. Containing World ..

Read more