Created
February 28, 2020 06:38
-
-
Save yasuyuki-kamata/6e65988e817507efff85dba900d5ce30 to your computer and use it in GitHub Desktop.
Disable Unity Analytics at runtime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class DisableAnalyticsAtRuntime : MonoBehaviour | |
{ | |
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] | |
public static void OnRuntimeMethodLoad() | |
{ | |
UnityEngine.Analytics.Analytics.enabled = false; | |
UnityEngine.Analytics.Analytics.deviceStatsEnabled = false; | |
UnityEngine.Analytics.Analytics.limitUserTracking = true; | |
#if UNITY_2018_3_OR_NEWER | |
UnityEngine.Analytics.Analytics.initializeOnStartup = false; | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment