using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TextureManager : MonoBehaviour
{
    // Start is called before the first frame update
    public static TextureManager instance;

    public Dictionary<string, Texture> textures;
    public Texture[] textureList;



    void Awake()
    {
        // Debug.Log($"LightmapSettings.lightmaps = {LightmapSettings.lightmaps.Length}");
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }

        textures = new Dictionary<string, Texture>();

        foreach (Texture t in textureList)
        {

            // s.source.outputAudioMixerGroup = mixerGroup;

            textures[t.name] = t;
        }

        // Renderer.lightmapIndex = -1;

    }


    public Texture GetTexture(string name)
    {

        Texture t = textures[name];
        if (t == null)
        {
            Debug.LogWarning("Texture: " + name + " not found!");
            return null;
        }

        return t;
    }
}