docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method SetAnalyticsEnabled

    SetAnalyticsEnabled(bool)

    Allows you to disable the Analytics service. When the service gets disabled all currently cached data both in RAM and on disk will be deleted and any new events will be voided. By default the service is enabled so you do not need to call this method on start. Will return instantly when disabling, must be awaited when re-enabling.

    Declaration
    [Obsolete("This method is part of the old consent flow and should no longer be used. For more information, please see the migration guide: https://docs.unity.com/ugs/en-us/manual/analytics/manual/sdk5-migration-guide")]
    Task SetAnalyticsEnabled(bool enabled)
    Parameters
    Type Name Description
    bool enabled
    Returns
    Type Description
    Task
    Examples

    To disable the Analytics Service before the game starts

    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    static void DisableAnalytics()
    {
        AnalyticsService.Instance.SetAnalyticsEnabled(false);
    }
    In This Article
    Back to top
    Copyright © 2023 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)