public int CopyBuildedAssetBundleToSTYLY(GameObject[] gameObjects) { var abUtility = new AssetBundleUtility(); var pcvrUtility = new PCVRUtility(); var buildedPathData = abUtility.GetBuildedAssetData(); var paltformName = "Windows"; foreach (var gameObject in gameObjects) { var buildedInfo = GetBuildedData(gameObject); string srcPath = Path.Combine(OutputPath + "STYLY_ASSET", paltformName); srcPath = CommonUtility.FixPathString(Path.Combine(srcPath, buildedInfo["guid"])); Debug.Log("assetBundlePath:" + srcPath); string destPath = CommonUtility.FixPathString(Path.Combine(pcvrUtility.GetSTYLYPersistentDataPath(), "STYLY_ASSET\\" + paltformName)); destPath = CommonUtility.FixPathString(Path.Combine(destPath, buildedInfo["guid"])); Debug.Log("STYLYPath:" + destPath); var result = pcvrUtility.PushFile(srcPath, destPath); if (result != 0) { return(-1); } } return(0); }
string GetBuildedGUID(string prefabPath) { var abUtility = new AssetBundleUtility(); var buildedAssetData = abUtility.GetBuildedAssetData(); var buildedData = buildedAssetData.GetData(prefabPath); string guid = null; buildedData.TryGetValue(BuildedAssetPathData.GUID_KEY, out guid); return(guid); }
string GetBuildedGUID(GameObject gameObject) { var prefabPath = AssetDatabase.GetAssetPath(PrefabUtility.GetPrefabParent(gameObject)); var abUtility = new AssetBundleUtility(); var buildedAssetData = abUtility.GetBuildedAssetData(); var buildedData = buildedAssetData.GetData(prefabPath); string guid = null; buildedData.TryGetValue(BuildedAssetPathData.GUID_KEY, out guid); return(guid); }
/// <summary> /// コンストラクター /// </summary> /// <param name="platformUtils">pcUtilsとandroidUtilsを結合したリスト</param> /// <param name="targetScene">ビルド対象シーン</param> public LocalPreviewToolBuilder(IEnumerable <IPlatformUtility> platformUtils, string targetScene) { // Setup stylyPluginUtility = new STYLYPluginUtility(); // abUtilityを新規作成する abUtility = new AssetBundleUtility(); // DI this.platformUtils = platformUtils; this.targetScene = targetScene; }
Dictionary <string, string> GetBuildedData(GameObject gameObject) { var prefabPath = AssetDatabase.GetAssetPath(PrefabUtility.GetPrefabParent(gameObject)); var abUtility = new AssetBundleUtility(); var buildedData = abUtility.GetBuildedAssetData(); var index = buildedData.prefabPathList.IndexOf(prefabPath); Dictionary <string, string> result = new Dictionary <string, string>(); result.Add("prefab path", buildedData.prefabPathList[index]); result.Add("guid", buildedData.guidList[index]); return(result); }
/// <summary> /// PrefabをビルドしてSTYLY Assetを作る /// </summary> /// <param name="prefab"></param> public bool BuildSTYLYAsset(GameObject prefab, BuildTarget buildTarget, string guid = null) { var abUtility = new AssetBundleUtility(); if (guid == null) { guid = abUtility.GenerateGUID(); } string outputPath = Path.Combine(OutputPath + "STYLY_ASSET", abUtility.GetPlatformName(buildTarget)); var buildResult = abUtility.Build(guid, AssetDatabase.GetAssetPath(prefab), outputPath, buildTarget); return(buildResult != null); }
/// <summary> /// AssetBundleのビルドを実行する /// </summary> /// <param name="scenePath">シーンのパス</param> /// <param name="buildTarget">ビルドターゲット(プラットフォーム)</param> /// <param name="guid">アセットバンドルのGUID</param> /// <returns></returns> public bool BuildSTYLYSceneAsset(string scenePath, BuildTarget buildTarget, string guid = null) { Debug.Log("BuildSTYLYSceneAsset:guid:" + guid); var abUtility = new AssetBundleUtility(); // プラットフォーム切換え abUtility.SwitchPlatformAndPlayerSettings(buildTarget); if (guid == null) { guid = abUtility.GenerateGUID(); } string outputPath = Path.Combine(OutputPath + "STYLY_ASSET", abUtility.GetPlatformName(buildTarget)); var buildResult = abUtility.Build(guid, scenePath, outputPath, buildTarget); return(buildResult != null); }
/// <summary> /// インスタンス破棄時の処理 /// </summary> private void Dispose() { // ユーティリティー系のフィールドをすべて破棄する。 stylyPluginUtility = null; abUtility = null; }