using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
|
public class SceneLoader
|
{
|
|
public static Texture2D LoadTexture(string folder, string name)
|
{
|
Texture2D texture2D = null;
|
if (AssetSource.sceneFromEditor)
|
{
|
#if UNITY_EDITOR
|
var path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Scene/", folder, "/", name, ".jpg");
|
texture2D = UnityEditor.AssetDatabase.LoadAssetAtPath<Texture2D>(path);
|
#endif
|
}
|
else
|
{
|
var assetInfo = new AssetInfo(StringUtility.Contact("maps/", folder).ToLower(), name);
|
texture2D = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as Texture2D;
|
}
|
|
if (texture2D == null)
|
{
|
DebugEx.LogErrorFormat("SceneLoader.LoadTexture() => 加载不到资源: {0}.", name);
|
}
|
|
return texture2D;
|
}
|
|
|
}
|