using UnityEngine;

public class SkinLoader : MonoBehaviour
{
    public string type;
    public int skin;

    private void Start()
    {
        Build();
    }

    public void Build()
    {
        if (type != "")
        {
            foreach (var item in FindObjectsOfType<Skin>(true))
            {
                if (item.type == type)
                {
                    item.skin = skin;
                    item.Build();
                }
            }
        }
    }

    private void OnValidate()
    {
        Build();
    }
}