using System; using UnityEngine; namespace Amanotes.TripleSDK.Core.Configuration { [InjectService] [UnityEngine.Scripting.Preserve] public class ConfigurationService { public ConfigurationService() { } public C GetConfiguration() where C: UnityEngine.Object, new() { C config = default(C); ServiceConfigurationAttribute attr = (ServiceConfigurationAttribute)Attribute.GetCustomAttribute(typeof(T), typeof(ServiceConfigurationAttribute)); if(attr != null) { config = Resources.Load(attr.Name); if(config == null) { Debug.LogError($"Could not found {attr.Name} asset"); } } return config; } } }