Inspector friendly Monobehaviour component for requesting a change to the specified platform's output sample rate and frame rate.
Inheritance: UnityEngine.MonoBehaviour
Ejemplo n.º 1
0
        void Awake()
        {
            if (__uniqueInstance != null)
            {
                Debug.LogError("Only one GATAudioInit should exist!");
                Destroy(this);
                return;
            }

            __uniqueInstance = this;

            RuntimePlatform  currentPlatform = Application.platform;
            PlatformSettings currentSettings = null;

            foreach (PlatformSettings settings in platformSettings)
            {
                if (settings.platform == currentPlatform)
                {
                    currentSettings = settings;
                    break;
                }
            }

            if (currentSettings == null)
            {
                                #if GAT_DEBUG
                Debug.LogWarning("GATAudioInit not configured for current platform: " + currentPlatform.ToString());
                                #endif
                return;
            }


            if (AudioSettings.outputSampleRate != currentSettings.sampleRate)
            {
                                #if UNITY_5
                Debug.LogWarning("GATAudioInit's sample rate setting is obsolete in Unity 5. Target platform samplerate can be configured in project settings.");
                                #else
                AudioSettings.outputSampleRate = currentSettings.sampleRate;
                GATInfo.SetRequestedSampleRate(currentSettings.sampleRate);
                                #endif
            }

            Application.targetFrameRate = currentSettings.targetFrameRate;
        }
Ejemplo n.º 2
0
        void Awake()
        {
            if( __uniqueInstance != null )
            {
                Debug.LogError( "Only one GATAudioInit should exist!" );
                Destroy( this );
                return;
            }

            __uniqueInstance = this;

            RuntimePlatform currentPlatform = Application.platform;
            PlatformSettings currentSettings = null;

            foreach( PlatformSettings settings in platformSettings )
            {
                if( settings.platform == currentPlatform )
                {
                    currentSettings = settings;
                    break;
                }
            }

            if( currentSettings == null )
            {
                #if GAT_DEBUG
                Debug.LogWarning( "GATAudioInit not configured for current platform: "+currentPlatform.ToString() );
                #endif
                return;
            }

            if( AudioSettings.outputSampleRate != currentSettings.sampleRate )
            {
                #if UNITY_5
                Debug.LogWarning( "GATAudioInit's sample rate setting is obsolete in Unity 5. Target platform samplerate can be configured in project settings." );
                #else
                AudioSettings.outputSampleRate = currentSettings.sampleRate;
                GATInfo.SetRequestedSampleRate( currentSettings.sampleRate );
                #endif
            }

            Application.targetFrameRate = currentSettings.targetFrameRate;
        }