void Awake()
    {
        if (Instance != null)
        {
            Destroy(gameObject);
            return;
        }
        Instance = this;
        //DontDestroyOnLoad(gameObject);

        library = FindObjectOfType <SoundLibrary>();
        if (library == null)
        {
            Debug.LogError("Sound library not found!");
        }
        library.ImportSoundGroups();

        masterVolumePercent = 1;    // PlayerPrefs.GetFloat("masterVolumePercent", 1f);
        musicVolumePercent  = 0.5f; //PlayerPrefs.GetFloat("musicVolumePercent", 1f);
        sfxVolumePercent    = PlayerPrefs.GetFloat("sfxVolumePercent", 1f);

        GameObject   newAudioSourceGO;
        AudioSource  newAudioSource;
        SourseKeeper newSourseKeeper;

        allSourseKeepers = new List <SourseKeeper>();

        int musicSoursesNumber = 2;

        musicKeepers = new SourseKeeper[musicSoursesNumber];
        for (int i = 0; i < musicSoursesNumber; i++)
        {
            newAudioSourceGO           = new GameObject("Music source " + (i + 1));
            newAudioSource             = newAudioSourceGO.AddComponent <AudioSource>();
            newAudioSource.loop        = true;
            newAudioSource.playOnAwake = false;
            newSourseKeeper            = new SourseKeeper(AudioSourseType.Music, newAudioSource, masterVolumePercent * musicVolumePercent, newAudioSourceGO);
            musicKeepers[i]            = newSourseKeeper;
            allSourseKeepers.Add(newSourseKeeper);
            newAudioSourceGO.transform.parent = transform;
        }

        sourseKeepers = new SourseKeeper[cyclingSoursesNumber];
        for (int i = 0; i < cyclingSoursesNumber; i++)
        {
            newAudioSourceGO           = new GameObject("Sound player source " + (i + 1));
            newAudioSource             = newAudioSourceGO.AddComponent <AudioSource>();
            newAudioSource.playOnAwake = false;
            newSourseKeeper            = new SourseKeeper(AudioSourseType.SFX, newAudioSource, masterVolumePercent * sfxVolumePercent, newAudioSourceGO);
            allSourseKeepers.Add(newSourseKeeper);
            sourseKeepers[i] = newSourseKeeper;
            newAudioSourceGO.transform.parent = transform;
            newAudioSourceGO.SetActive(false);
        }

        newAudioSourceGO      = new GameObject("sfx source");
        sfxSource             = newAudioSourceGO.AddComponent <AudioSource>();
        sfxSource.playOnAwake = false;
        newSourseKeeper       = new SourseKeeper(AudioSourseType.SFX, sfxSource, masterVolumePercent * sfxVolumePercent, newAudioSourceGO);
        allSourseKeepers.Add(newSourseKeeper);
        newAudioSourceGO.transform.parent = transform;

        soundPlayersDictionary = new Dictionary <int, SoundPlayer>();

        soundPlayersOfGroupCount = new Dictionary <string, int>();
        nextTimeAllowed          = new Dictionary <string, float>();

        foreach (string key in library.GetKeys())
        {
            soundPlayersOfGroupCount.Add(key, 0);
            nextTimeAllowed.Add(key, 0);
        }
    }