IEnumerator LoadDirectResource(Resource res) { string loadPath = GetInResPath(res); ResourceRequest request = Resources.LoadAsync(loadPath); yield return(request); res.isDone = true; if (request.asset == null) { res.errorTxt = "Load resource [" + loadPath + "] fail!"; CLog.LogError(res.errorTxt); } else { res.SetDirectObject(request.asset); } OnDone(res); }
public override void Load(Resource res) { string loadPath = GetInResPath(res); UnityEngine.Object go = null; #if UNITY_EDITOR go = UnityEditor.AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(loadPath); #endif res.isDone = true; if (go == null) { res.errorTxt = "Load resource [" + loadPath + "] fail!"; CLog.LogError(res.errorTxt); } else { res.SetDirectObject(go); } OnDone(res); }