private void GenericRequest <T>(string key, ContentReceiveHandler <T> onResult) where T : UnityEngine.Object { var asset = Resources.Load <T>(key); if (asset == null) { onResult(key, ContentReceiveResult <T> .Error($"Content ({key}) not found")); } else { onResult(key, ContentReceiveResult <T> .Success(asset)); } }
public void RequestTexture(string key, ContentReceiveHandler <Texture> onResult) { GenericRequest(key, onResult); }
public void RequestAudio(string key, ContentReceiveHandler <AudioClip> onResult) { GenericRequest(key, onResult); }
public void RequestFont(string key, ContentReceiveHandler <Font> onResult) { GenericRequest(key, onResult); }
public void RequestSprite(string key, ContentReceiveHandler <Sprite> onResult) { GenericRequest(key, onResult); }
public void RequestXml(string key, ContentReceiveHandler <string> onResult) { var xmlAsset = Resources.Load <TextAsset>(key); onResult(key, ContentReceiveResult <string> .Success(xmlAsset.text)); }