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);
        }
Beispiel #2
0
        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);
        }