ResourceHelper.cs 433 字节
Newer Older
1 2 3 4 5 6 7
using UnityEditor;
using UnityEngine;

namespace Model
{
	public static class ResourceHelper
	{
8
		public static UnityEngine.Object LoadResource(string bundleName, string prefab)
9 10 11 12 13 14 15
		{
			string[] realPath = AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName(bundleName.ToLower() + ".unity3d", prefab);
			UnityEngine.Object resource = AssetDatabase.LoadAssetAtPath(realPath[0], typeof(GameObject));
			return resource;
		}
	}
}