*************** CoreApplication *************** In every scene using either the RestAPI, the CrossPromo or the ScalableServer, there should be an object with the ``CoreApplication`` component. This is a singleton that will eventually manage every aspect of the SDK. ``CoreApplication`` is the single point of access to core components: - Scene transitions - Event messaging system - Analytics - Network parameters - ... It can also run Coroutines for objects that are not MonoBehaviours. Integration in your game ------------------------ In your scene: - Add an empty object - Add the ``CoreApplication`` component to it. This will automatically add all the other components it requires. **You should save this object as a prefab to re-use in other scenes.** .. image:: ../Images/coreapplication-image1.png One Singleton to rule them all ------------------------------ The CoreApplication is a GameObject marked as `DontDestroyOnLoad`. It's a singleton and the first instance created during a session will live until you stop your game. If you followed the good practice of adding a ``CoreApplication`` prefab in all you scenes, the ``CoreApplication`` you keep at runtime is the one from the first scene loaded. Extending with your own elements -------------------------------- Having multiple singletons in an application is usually a bad idea. They are often written in different ways by several developers and subtile bugs can appear. That's why we created the ``CoreApplication`` component. If you have you own singletons, core managers... you can easily access them from the ``CoreApplication``. Create a subclass of ``CoreApplicationDelegate`` with a property to access your singleton and simply replace the one we automatically add to ``CoreApplication``. This way you will be able to write: .. code:: csharp MyCustomDelegate delegate = (MyCustomDelegate)CoreApplication.Instance.CoreApplicationDelegate; delegate.MyCustomSingleton.DoSomething(); Coroutine --------- The ``CoreApplication.ExecuteCoroutine(IEnumerator action)`` method is a Coroutine facilitator. It allows to execute Coroutines in Play Mode, even if CoreApplication instance doesn't exist (like in Play Mode tests).