docs.unity3d.com

    Services Core

    This package provides a solution to initialize all game services in a single call and defines common components used by multiple game service packages. These components are standardized and aim to unify the overall experience of working with game service packages.

    Package contents

    Initialize game services

    To initialize all game services at once you just have to call UnityServices.InitializeAsync(). It returns a Task that enables you to monitor the initialization's progression.

    Example

    using System;
    using Unity.Services.Core;
    using Unity.Services.Core.Environments;
    using UnityEngine;
    
    public class InitializeUnityServices : MonoBehaviour
    {
        public string environment = "production";
    
        async void Start()
        {
            try
            {
                var options = new InitializationOptions()
                    .SetEnvironmentName(environment);
    
                await UnityServices.InitializeAsync(options);
            }
            catch (Exception exception)
            {
                // An error occured during services initialization.
            }
        }
    }
    

    Technical details

    The InitializeAsync methods affects the currently installed service packages in your Unity project.

    Note that this method is not supported during edit time.

    Requirements

    • Supported Unity Editor: 2019.4 and later.
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your 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.
    Generated by DocFX on 18 October 2023