realitycollective / com.realitycollective.service-framework

The Service Framework package components for the Reality Collective. This package an extensible service framework to build highly performant components for your Unity projects.
https://service-framework.realitycollective.net
MIT License
7 stars 4 forks source link

Introduce ServiceManager.IsActiveAndInitialized #32

Closed FejZa closed 1 year ago

FejZa commented 1 year ago

Reality Collective - Reality Toolkit Pull Request

Overview

I keep having to check if ServcieManager.Instance is not null and ServiceManager.Intance.IsInitialized. Also I keep getting NREs in cases where some scripts or components, mostly editor windows / inspectors try to access ServiceManager.Instance, when it is not available. E.g. when editing prefabs or working in a scene that does not have the service manager.

This new API ServiceManager.IsActiveAndInitialized is a shorthand to check if the service manager is available.

Changes

What I said above.

Breaking Changes

Manual testing status

Tested.