首次提交
This commit is contained in:
33
Assets/Plugins/FairyGUI/Examples/Editor/BuildAssetBundles.cs
Normal file
33
Assets/Plugins/FairyGUI/Examples/Editor/BuildAssetBundles.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
|
||||
public class BuildAssetBundles
|
||||
{
|
||||
[MenuItem("Window/Build FairyGUI Example Bundles")]
|
||||
public static void Build()
|
||||
{
|
||||
string testPath = "UI/BundleUsage_fui";
|
||||
Object obj = Resources.Load(testPath);
|
||||
string path = AssetDatabase.GetAssetPath(obj);
|
||||
if(string.IsNullOrEmpty(path))
|
||||
{
|
||||
Debug.LogWarning("sample not found: " + testPath);
|
||||
return;
|
||||
}
|
||||
string basePath = path.Substring(0, path.Length - testPath.Length - 6);
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
AssetImporter.GetAtPath(basePath + "Icons/i" + i + ".png").assetBundleName = "fairygui-examples/i" + i + ".ab";
|
||||
}
|
||||
|
||||
AssetImporter.GetAtPath(basePath + "UI/BundleUsage_fui.bytes").assetBundleName = "fairygui-examples/bundleusage.ab";
|
||||
AssetImporter.GetAtPath(basePath + "UI/BundleUsage_atlas0.png").assetBundleName = "fairygui-examples/bundleusage.ab";
|
||||
|
||||
if (!Directory.Exists(Application.streamingAssetsPath))
|
||||
Directory.CreateDirectory(Application.streamingAssetsPath);
|
||||
|
||||
BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb6ce699bc9e31440b4f01462aacc612
|
||||
timeCreated: 1446625466
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user