public override void OnStkInitialized(SoundToolKitManager soundToolKitManager) { if (!Initialized) { // <STK.LITE> // Warning: Modifying this code may result in plugin instability and frequent crashes to desktop. // This is the SoundToolKit Lite version. // Internally only three SoundSources can be created simultaneously, so circumventing this check will not result // in a possibility of creating more sound sources - only more references to the same source. if (soundToolKitManager.ResourceContainer.AudioSources.Count >= StkLite.AvailableSources()) { SoundToolKitDebug.Log("Only three SoundSources are available simultaneously in the SoundToolKit " + "Lite version. Deleting the illegal SoundSource components at GameObject " + gameObject.name); Destroy(this); return; } // </STK.LITE> SoundToolKitDebug.Assert(soundToolKitManager.StkAudioEngine != null, "AudioEngine is not initialized."); var audioEngine = soundToolKitManager.StkAudioEngine; m_ambientSoundSource = audioEngine.ResourcesFactory.CreateAmbientSoundSource(); UpdateSourceProperties(); soundToolKitManager.ResourceContainer.Add(audioSource: this); m_playbackComponent = new PlaybackComponent(m_ambientSoundSource); m_playbackComponent.InitializeInternalPlaybacks(Playbacks); m_playbackComponent.PlayOnAwake(Playbacks, gameObject.activeSelf, isActiveAndEnabled); Initialized = true; } }
public override void OnStkInitialized(SoundToolKitManager soundToolKitManager) { if (!Initialized) { base.OnStkInitialized(soundToolKitManager); m_playbackComponent = new PlaybackComponent(m_spatialSoundSource); m_playbackComponent.InitializeInternalPlaybacks(Playbacks); m_playbackComponent.PlayOnAwake(Playbacks, gameObject.activeSelf, isActiveAndEnabled); Initialized = true; } }