Loader 未完成版本
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public static class Loader
{
public static Object Load( string FileName , System.Type type , AssetBundle SaveBundle = null )
{
Object bkObj = null;
string NewFileName = "";
#if UNITY_EDITOR
int Index = FileName.LastIndexOf(".");
if(Index>0)
{
NewFileName = FileName.Substring(0,Index);
bkObj = Resources.LoadAssetAtPath("Assets/Used/"+FileName, type) ;
}
else
{
NewFileName = FileName;
}
Debug.Log ("is UNITY_EDITOR is " + NewFileName);
#else
int Index = FileName.LastIndexOf(".");
if(Index>0)
{
NewFileName = FileName.Substring(0,Index);
}
else
{
NewFileName = FileName;
}
if( SaveBundle == null)
{
Debug.Log ("Not UNITY_EDITOR 1 " + NewFileName);
bkObj = Resources.LoadAssetAtPath("Assets/Used/"+FileName, type) ;
if( bkObj == null)
{
bkObj = Resources.Load (NewFileName, type );
}
}
else
{
Debug.Log ("Not UNITY_EDITOR 2 " + NewFileName);
bkObj = SaveBundle.Load (NewFileName, type );
}
#endif
return bkObj;
}
}
沒有留言:
張貼留言