.. _service-api-game-scenes: Game Scenes =========== Anything that can be called is configured to be available from a particular game scene, or scenes. This includes service procedures and properties, and class methods and properties. This is controlled by the following enumeration: .. cs:enum:: KRPC.Service.GameScene .. cs:enumerator:: Inherit Inherit the game scene from the class hierarchy and the services. This is the default. .. cs:enumerator:: All All game scenes. .. cs:enumerator:: SpaceCenter The game scene showing the Kerbal Space Center buildings. .. cs:enumerator:: Flight The game scene showing a vessel in flight (or on the launchpad/runway). .. cs:enumerator:: TrackingStation The tracking station. .. cs:enumerator:: EditorVAB The Vehicle Assembly Building. .. cs:enumerator:: EditorSPH The Space Plane Hangar. .. cs:enumerator:: Editor Either the VAB or the SPH. .. cs:enumerator:: MissionBuilder The mission builder. .. cs:enumerator:: AstronautComplex The astronaut complex facility, open within the space center scene. .. cs:enumerator:: MissionControl The mission control facility, open within the space center scene. .. cs:enumerator:: ResearchAndDevelopment The research and development facility, open within the space center scene. .. cs:enumerator:: Administration The administration facility, open within the space center scene. The special enumeration value :cs:value:`KRPC.Service.GameScene.Inherit` can be used to inherit the game scene setting. Game scene inheritance works as follows: * The procedures of a service set to :cs:value:`KRPC.Service.GameScene.Inherit` will be available in all game scenes. This is the default. Its classes take their game scenes from the classes and services further up the hierarchy, so they can differ from those of a service set to :cs:value:`KRPC.Service.GameScene.All`. * A service procedure or property set to :cs:value:`KRPC.Service.GameScene.Inherit` will be available in the same game scenes as the containing service. * A class method or property set to :cs:value:`KRPC.Service.GameScene.Inherit` will be available in the game scenes of the class of the object it is called on. A class set to :cs:value:`KRPC.Service.GameScene.Inherit` takes them from its base classes and services. :ref:`service-api-availability` gives the full order, which the required mods share. **Examples** * Declare a service whose procedures are available in the :cs:value:`KRPC.Service.GameScene.Flight` game scene: .. literalinclude:: /scripts/extending/game-scenes/ServiceInScene.lib.cs :language: csharp :start-after: [docs] :end-before: [/docs] :dedent: * Declare a service whose procedures are available in the :cs:value:`KRPC.Service.GameScene.Flight` and :cs:value:`KRPC.Service.GameScene.Editor` game scenes: .. literalinclude:: /scripts/extending/game-scenes/ServiceInScenes.lib.cs :language: csharp :start-after: [docs] :end-before: [/docs] :dedent: * Declare a service whose procedures are available in the :cs:value:`KRPC.Service.GameScene.Flight` game scene by default, and declare a procedure which overrides this and is available in all game scenes: .. literalinclude:: /scripts/extending/game-scenes/ProcedureInScenes.lib.cs :language: csharp :start-after: [docs] :end-before: [/docs] :dedent: