# 环境支持

> Learn how Analytics works with Unity Gaming Services environments, and how to initialize the SDK for different environments.

环境是指 Unity Game Services（Unity 游戏服务）的逻辑分区，其中包含与项目关联的数据。借助 Analytics，您可以通过在初始化 UnityServices 时向 `InitializationOptions` 添加代码来将事件发送到不同的环境。

```cs
using UnityEngine;
using Unity.Services.Core;
using Unity.Services.Analytics;
using System.Collections.Generic;
using Unity.Services.Core.Environments;

class InitWithEnvironment : MonoBehaviour {

   async void Awake()
   {
       var options = new InitializationOptions();
       options.SetEnvironmentName("dev");
       await UnityServices.InitializeAsync(options);
   }
}
```

基础键为：

`com.unity.services.core.environment-name`

如需更多详细信息，请参阅[“环境”页面](/services/service-environments.md)。
