docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SheetsServiceProvider

    The Sheets service provider performs the authentication to Google and keeps track of the authentication tokens so that you do not need to authenticate each time. The Sheets service provider also includes general sheet properties, such as default sheet styles, that are used when creating a new sheet.

    Inheritance
    object
    Object
    ScriptableObject
    SheetsServiceProvider
    Implements
    IGoogleSheetsService
    ISerializationCallbackReceiver
    Inherited Members
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(string)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.name
    Object.hideFlags
    Namespace: UnityEditor.Localization.Plugins.Google
    Assembly: Unity.Localization.Editor.dll
    Syntax
    [CreateAssetMenu(fileName = "Google Sheets Service", menuName = "Localization/Google Sheets Service")]
    [HelpURL("https://developers.google.com/sheets/api/guides/authorizing#AboutAuthorization")]
    public class SheetsServiceProvider : ScriptableObject, IGoogleSheetsService, ISerializationCallbackReceiver
    Examples

    Unity recommends to have a SheetsServiceProvider asset pre-configured for use, however this example does create a new one.

    // The Sheets service provider performs the authentication and keeps track of the
    // authentication tokens so that we do not need to authenticate each time.
    // It is recommended to have a SheetsServiceProvider asset pre-configured for
    // use however in this example we will create a new one.
    var sheetServiceProvider = ScriptableObject.CreateInstance<SheetsServiceProvider>();
    
    // OAuth is required when making changes. See the docs for info setting up OAuth credentials.
    sheetServiceProvider.SetOAuthCredentials("some-client-id", "some-client-secret");
    return sheetServiceProvider;

    Properties

    Name Description
    ApiKey

    The API Key to use when using APIKey authentication.

    ApplicationName

    The name of the application that will be sent when connecting.

    Authentication

    The authorization methodology to use. See https://developers.google.com/sheets/api/guides/authorizing

    ClientId

    Client Id when using OAuth authentication.

    See also SetOAuthCredentials(string)
    ClientSecret

    Client secret when using OAuth authentication.

    See also SetOAuthCredentials(string)
    DataStore

    Used to make sure the access and refresh tokens persist. Uses a FileDataStore by default with "Library/Google/{name}" as the path.

    NewSheetProperties

    Properties to use when creating a new Google Spreadsheet sheet.

    Service

    The Google Sheet service that will be created using the Authorization API.

    Methods

    Name Description
    AuthoizeOAuth()

    Call to preauthorize when using OAuth authorization. This will cause a browser to open a Google authorization page after which the token will be stored in IDataStore so that this does not need to be done each time. If this is not called then the first time Service is called it will be performed then.

    AuthorizeOAuth()

    Call to preauthorize when using OAuth authorization. This will cause a browser to open a Google authorization page after which the token will be stored in IDataStore so that this does not need to be done each time. If this is not called then the first time Service is called it will be performed then.

    AuthorizeOAuthAsync(CancellationToken)

    Call to preauthorize when using OAuth authorization. This will cause a browser to open a Google authorization page after which the token will be stored in IDataStore so that this does not need to be done each time. If this is not called then the first time Service is called it will be performed then.

    SetApiKey(string)

    Set the API Key. An API key can only be used for reading from a public Google Spreadsheet.

    SetOAuthCredentials(string)

    Enable OAuth 2.0 authentication and extract the ClientId and ClientSecret from the supplied json.

    SetOAuthCredentials(string, string)

    Enable OAuth 2.0 authentication with the provided client Id and client secret.

    SetOAuthCrendtials(string)

    Enable OAuth 2.0 authentication and extract the ClientId and ClientSecret from the supplied json.

    SetOAuthCrendtials(string, string)

    Enable OAuth 2.0 authentication and extract the ClientId and ClientSecret from the supplied json.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)