using Newtonsoft.Json;
using UnityEngine;

public abstract class Config {

    public static T LoadFromResources<T>(string path) where T : new() {
        var asset = Resources.Load<TextAsset>(path);
        if (asset == null) {
            Debug.LogError("No config named " + path + " in resources");
            return default(T);
        }
        T config = JsonConvert.DeserializeObject<T>(asset.text);
        return config;
    }
}
