Documentation

​
​

Development

User Acquisition

Monetization

Industry

Services

Collaboration

LiveOps

Multiplayer

Services

​
​
Overview
  • Overview
  • Get started
  • Pricing and billing
  • Concepts
    • Access control
    • Asset management
    • Asynchronous code
    • CLI
    • Create Asset Store packages
    • Environments
    • Environments API
    • Unity Cloud Services APIs
    • Privacy and Data Safety
    • Services Core SDK API
    • Unity Dashboard
    • Upgrade SDK versions
  • Release notes
Secret Manager
  • Overview
  • Concepts
  • Tutorials
  • Reference
Services
  • Collaboration
  • LiveOps
  • Multiplayer
Reference
  • Overview
Solutions
  • Overview
  • Sample projects
  1. Overview

Environments API

Manage logical data partitions using the Environments API.
Read time 2 minutes
Last updated 9 months ago

Environments are logical partitions for Unity Gaming Services that contain data associated with your project.
This section focuses on the Environments API in the Core package. The access point to the Environments API is through the
EnvironmentsApi
singleton.
namespace Unity.Services.Core.Environments.Editor{ public class EnvironmentsApi { public static IEnvironmentsApi Instance { get; } }}

Environment Selector

The Environment Selector sets the current environment for all supported services.
To select an environment in the Unity Editor:
  1. Go to Edit > Project Settings > Services > Environments.
  2. In the Editor Environment field, select the environment to use.
You can manage environments, such as adding or deleting environments, in the Unity Dashboard.

Active environment

You can access the active environment as the name or GUID. The
PropertyChanged
event informs you when the environment changes.
namespace Unity.Services.Core.Environments.Editor{ public class EnvironmentsApi { public string ActiveEnvironmentName { get; set; } public System.Nullable<System.Guid> ActiveEnvironmentId { get; } public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; }}

Environment management

The
EnvironmentsApi
allows you to refresh the environments list, get all environments, set the active environment, and validate that the active environment still exists remotely.
namespace Unity.Services.Core.Editor.Environments{ public class EnvironmentsApi { public System.Collections.Generic.IReadOnlyCollection<EnvironmentInfo> Environments { get; } public System.Threading.Tasks.Task RefreshAsync(); public void SetActiveEnvironment(EnvironmentInfo environment); public System.Threading.Tasks.Task<ValidationResult> ValidateEnvironmentAsync(); }}

Build and runtime

At build and runtime, the chosen environment uses a priority fallback mechanism to choose the correct environment:
InitializationOptions
>> Environment Selector >> default environment (
"production"
).
Using
InitializationOptions
is shown in the Services Core SDK Initialization example.

UI components

The
EnvironmentView
component displays the current active environment and allows quick access to the global Environment Selector.
Environment selector component
The following example shows how to add this component into a toolbar with UXML:
<ui:UXML xmlns:uie="UnityEditor.UIElements" xmlns:coreUi="Unity.Services.Core.Editor.Environments.UI" editor-extension-mode="True"> <uie:Toolbar> <coreUi:EnvironmentView /> </uie:Toolbar></ui:UXML>

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • Environment Selector

    • Active environment

    • Environment management

    • Build and runtime

    • UI components


Report a problem with this page