Last active
June 3, 2024 01:44
-
-
Save desmondfernando/32b6e12d2c9fca9ff00a1608161b6184 to your computer and use it in GitHub Desktop.
Code snippet to disable HW statistics reporting. NOTE only works in the Editor not for runtime! Unity Pro only
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
var type = Type.GetType( "UnityEditor.PlayerSettings,UnityEditor" ); | |
if ( type != null ) | |
{ | |
var propertyInfo = type.GetProperty( "submitAnalytics", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static ); | |
if ( propertyInfo != null ) | |
{ | |
{ | |
var value = (bool)propertyInfo.GetValue( null, null ); | |
Debug.LogFormat( "PlayerSettings.submitAnalytics {0}", value ); | |
} | |
if ( propertyInfo.CanWrite ) | |
{ | |
propertyInfo.SetValue( null, false, null ); | |
var value = (bool)propertyInfo.GetValue( null, null ); | |
Debug.LogFormat( "PlayerSettings.submitAnalytics {0}", value ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this snippet to disable HW statistics reporting. I use this within my CI build scripts.
PlayerSettings.submitAnalytics is not public so you need to use reflection in order to modify.
https://docs.unity3d.com/Manual/class-PlayerSettingsStandalone.html