Merge branch 'master' of http://192.168.31.100:8088/framework/xosmopluginlibrary
This commit is contained in:
@@ -13,8 +13,7 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
public void OnEnable()
|
||||
{
|
||||
|
||||
GetPackageVersion();
|
||||
BuildPipelineViewer();
|
||||
oldVersionX = packageVersionX;
|
||||
oldVersionY = packageVersionY;
|
||||
oldVersionZ = packageVersionZ;
|
||||
@@ -120,6 +119,8 @@ namespace Stary.Evo.Editor
|
||||
// [OnValueChanged("SetEncryptionServices")]
|
||||
// public Type encryption;
|
||||
|
||||
|
||||
|
||||
[HideLabel] public AbstractBuildPipelineViewer viewer;
|
||||
|
||||
[HideLabel] private Dictionary<EBuildPipeline, AbstractBuildPipelineViewer> _viewers;
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
private static BuildAssetWindow window;
|
||||
|
||||
|
||||
|
||||
[MenuItem("Evo/资源打包工具")]
|
||||
static void ShowWindows()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
using YooAsset.Editor;
|
||||
|
||||
@@ -44,7 +45,8 @@ namespace Stary.Evo.Editor
|
||||
var buildResult = pipeline.Run(buildParameters, true);
|
||||
if (buildResult.Success)
|
||||
{
|
||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||
Debug.Log($"Build Success! 【{buildResult.OutputPackageDirectory}】");
|
||||
//EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||
base.ExecuteBuild();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using EditorFramework;
|
||||
using HybridCLR.Editor;
|
||||
using HybridCLR.Editor.Settings;
|
||||
using Sirenix.OdinInspector;
|
||||
using Sirenix.OdinInspector.Editor;
|
||||
using Sirenix.Utilities;
|
||||
using Stary.Evo.InformationSave;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
|
||||
@@ -60,10 +60,15 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
this.dataSetting = dataSetting;
|
||||
useAssetDependencyDBToggle = true;
|
||||
SetUseAssetDependencyDB();
|
||||
clearBuildCacheToggle = false;
|
||||
SetBuildCacheToggle();
|
||||
compression = ECompressOption.LZ4;
|
||||
SetCompression();
|
||||
fileNameStyle = EFileNameStyle.BundleName;
|
||||
SetFileNameStyle();
|
||||
copyBuildinFileOption = EBuildinFileCopyOption.ClearAndCopyAll;
|
||||
SetCopyBuildinFileOption();
|
||||
}
|
||||
|
||||
#region AssetBuild
|
||||
|
||||
100
Assets/00.StaryEvo/Editor/BuildAsset/OneKeyBuildWindow.cs
Normal file
100
Assets/00.StaryEvo/Editor/BuildAsset/OneKeyBuildWindow.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using HybridCLR.Editor;
|
||||
using HybridCLR.Editor.Commands;
|
||||
using HybridCLR.Editor.Settings;
|
||||
using Sirenix.OdinInspector;
|
||||
using Sirenix.OdinInspector.Editor;
|
||||
using Stary.Evo.InformationSave;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using YooAsset.Editor;
|
||||
|
||||
namespace Stary.Evo.Editor
|
||||
{
|
||||
public class OneKeyBuildWindow : OdinEditorWindow
|
||||
{
|
||||
[MenuItem("Evo/(一键)打包工具")]
|
||||
static void Init()
|
||||
{
|
||||
var window = (OneKeyBuildWindow)EditorWindow.GetWindow(typeof(OneKeyBuildWindow));
|
||||
window.Show();
|
||||
}
|
||||
|
||||
[ListDrawerSettings(DraggableItems = false, ShowFoldout = false, ShowPaging = false, ShowItemCount = false,
|
||||
HideRemoveButton = true)]
|
||||
public List<OneKeyBUildEntity> OneKeyBUildEntities = new List<OneKeyBUildEntity>();
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
var creatDomainAll = CreatAssetWindow.GetCreatDomainAll();
|
||||
foreach (var domainEntity in creatDomainAll)
|
||||
{
|
||||
OneKeyBUildEntities.Add(new OneKeyBUildEntity()
|
||||
{
|
||||
DomainName = domainEntity.DomainName
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Button("(一键)标记选择资源",ButtonSizes.Large)]
|
||||
public void OneClickMark()
|
||||
{
|
||||
//打dll
|
||||
CompileDllCommand.CompileDllActiveBuildTarget();
|
||||
//拷贝dll
|
||||
MarkAdressable.AddHotfixAddressableDllAll(OneKeyBUildEntities);
|
||||
//标记全部资源
|
||||
MarkAdressable.AddMarkAll(OneKeyBUildEntities);
|
||||
EditorUtility.DisplayDialog("提示", $"标记所有资源完成!", "确定");
|
||||
}
|
||||
|
||||
[Button("(一键)打包选择资源",ButtonSizes.Large)]
|
||||
public void OneClickBuild()
|
||||
{
|
||||
//打包
|
||||
EditorTools.ClearUnityConsole();
|
||||
|
||||
foreach (var oneKeyBUildEntity in OneKeyBUildEntities)
|
||||
{
|
||||
if (oneKeyBUildEntity.isRaw)
|
||||
{
|
||||
|
||||
|
||||
BuildAssetDataSetting buildAssetDataSetting =
|
||||
AssetDatabase.LoadAssetAtPath<BuildAssetDataSetting>(
|
||||
$"Assets/Domain/{oneKeyBUildEntity.DomainName}/Conf/BuildAssetDataSetting.asset");
|
||||
if (buildAssetDataSetting != null)
|
||||
{
|
||||
buildAssetDataSetting.environmentType = EnvironmentType.Release;
|
||||
buildAssetDataSetting.SetEnvironmentType();
|
||||
buildAssetDataSetting.viewer = new BuiltinBuildPipelineViewer(buildAssetDataSetting);
|
||||
buildAssetDataSetting.viewer.clearBuildCacheToggle = true;
|
||||
buildAssetDataSetting.viewer.SetBuildCacheToggle();
|
||||
EditorApplication.delayCall += buildAssetDataSetting.viewer.ExecuteBuild;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("BuildAssetDataSetting 不存在:" + oneKeyBUildEntity.DomainName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorUtility.DisplayDialog("提示", $"开始打包资源!", "确定");
|
||||
}
|
||||
}
|
||||
|
||||
public struct OneKeyBUildEntity
|
||||
{
|
||||
[Title("是否打包", titleAlignment: TitleAlignments.Centered)] [HideLabel, HorizontalGroup("OneKeyBUildEntity")]
|
||||
public bool isRaw;
|
||||
|
||||
[Title("包名", titleAlignment: TitleAlignments.Centered)]
|
||||
[HideLabel, ReadOnly, HorizontalGroup("OneKeyBUildEntity")]
|
||||
public string DomainName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26f920eb9cb048179fdc641cfd92ed93
|
||||
timeCreated: 1746583992
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
using YooAsset.Editor;
|
||||
|
||||
@@ -43,7 +44,8 @@ namespace Stary.Evo.Editor
|
||||
var buildResult = pipeline.Run(buildParameters, true);
|
||||
if (buildResult.Success)
|
||||
{
|
||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||
Debug.Log($"Build Success! 【{buildResult.OutputPackageDirectory}】");
|
||||
// EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||
base.ExecuteBuild();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
using YooAsset.Editor;
|
||||
|
||||
@@ -46,7 +47,8 @@ namespace Stary.Evo.Editor
|
||||
var buildResult = pipeline.Run(buildParameters, true);
|
||||
if (buildResult.Success)
|
||||
{
|
||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||
Debug.Log($"Build Success! 【{buildResult.OutputPackageDirectory}】");
|
||||
// EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||
base.ExecuteBuild();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace Stary.Evo.Editor
|
||||
private static string[] configNames = new[] { "DomainConfig" };
|
||||
|
||||
|
||||
|
||||
public static string DomainRoot
|
||||
{
|
||||
get { return Application.dataPath + "/Domain"; }
|
||||
@@ -51,13 +50,31 @@ namespace Stary.Evo.Editor
|
||||
//[MenuItem("Evo/Hotfix/Addressable")]
|
||||
public static void AddHotfixAddressableDll()
|
||||
{
|
||||
CopyDllHotUpdateAssembly(BuildAssetWindow.GetBuildPackageName(), $"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
||||
CopyDllHotUpdateAssembly(BuildAssetWindow.GetBuildPackageName(),
|
||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
||||
CopyDllStrippedAOTDllOutputRootDir($"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
||||
|
||||
|
||||
//EditorUtility.DisplayDialog("自动标记", "自动Hotfix成功", "确定");
|
||||
}
|
||||
|
||||
public static void AddHotfixAddressableDllAll(List<OneKeyBUildEntity> oneKeyBUildEntities)
|
||||
{
|
||||
var DomainAll = CreatAssetWindow.GetCreatDomainAll();
|
||||
|
||||
foreach (var oneKeyBUildEntity in oneKeyBUildEntities)
|
||||
{
|
||||
if (oneKeyBUildEntity.isRaw)
|
||||
{
|
||||
CopyDllHotUpdateAssembly(oneKeyBUildEntity.DomainName, $"{DomainRoot}/{oneKeyBUildEntity.DomainName}/AddressableRes");
|
||||
CopyDllStrippedAOTDllOutputRootDir($"{DomainRoot}/{oneKeyBUildEntity.DomainName}/AddressableRes");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//EditorUtility.DisplayDialog("自动标记", "自动Hotfix成功", "确定");
|
||||
}
|
||||
|
||||
private static void CopyDllHotUpdateAssembly(string domain, string target)
|
||||
{
|
||||
//读取打包dll位置
|
||||
@@ -108,34 +125,40 @@ namespace Stary.Evo.Editor
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddMarkAll(List<OneKeyBUildEntity> oneKeyBUildEntities)
|
||||
{
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.ClearAll();
|
||||
foreach (var oneKeyBUildEntity in oneKeyBUildEntities)
|
||||
{
|
||||
if (oneKeyBUildEntity.isRaw)
|
||||
{
|
||||
string configPath =
|
||||
$"Assets/Domain/{oneKeyBUildEntity.DomainName}/Conf/HotfixMainResDomain.asset";
|
||||
HotfixMainResDomain hotfixMainResDomain =
|
||||
AssetDatabase.LoadAssetAtPath<HotfixMainResDomain>(configPath);
|
||||
packageName = hotfixMainResDomain.hotfixMainResDomainEntity.domain;
|
||||
Mark();
|
||||
if (!oneKeyBUildEntity.DomainName.Equals("Main"))
|
||||
CreateRes(packageName,
|
||||
$"{DomainRoot}/{oneKeyBUildEntity.DomainName}/AddressableRes",
|
||||
$"{DomainRoot}/{oneKeyBUildEntity.DomainName}/HotUpdate");
|
||||
else
|
||||
CreateRes(packageName,
|
||||
$"{DomainRoot}/{oneKeyBUildEntity.DomainName}/AddressableRes",
|
||||
$"{MainDomainRoot}/Script/Runtime/HotUpdate");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//[MenuItem("Evo/Hotfix/标记资源")]
|
||||
public static void AddMark()
|
||||
{
|
||||
// //清空主包旧数据
|
||||
AssetBundleCollectorPackage assetBundleCollectorPackage = null;
|
||||
// foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
|
||||
// {
|
||||
// if (package.PackageName == "Main")
|
||||
// {
|
||||
// assetBundleCollectorPackage = package;
|
||||
// }
|
||||
// }
|
||||
// if (assetBundleCollectorPackage != null)
|
||||
// {
|
||||
// YooAsset.Editor.AssetBundleCollectorSettingData.RemovePackage(assetBundleCollectorPackage);
|
||||
// }
|
||||
// DomainRoot = DomainMainPath;
|
||||
// packageName = "Main";
|
||||
// Mark();
|
||||
// CreateRes(packageName,
|
||||
// $"{DomainRoot}/Main/AddressableRes",
|
||||
// $"{DomainRoot}/Main/Script");
|
||||
|
||||
|
||||
|
||||
AssetBundleCollectorPackage assetBundleCollectorPackage = null;
|
||||
//copydll
|
||||
if(!BuildAssetWindow.GetBuildPackageName().Equals("Main"))
|
||||
AddHotfixAddressableDll();
|
||||
if (!BuildAssetWindow.GetBuildPackageName().Equals("Main"))
|
||||
AddHotfixAddressableDll();
|
||||
//清空用户旧数据
|
||||
|
||||
foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
|
||||
@@ -145,19 +168,21 @@ namespace Stary.Evo.Editor
|
||||
assetBundleCollectorPackage = package;
|
||||
}
|
||||
}
|
||||
|
||||
if (assetBundleCollectorPackage != null)
|
||||
{
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.RemovePackage(assetBundleCollectorPackage);
|
||||
}
|
||||
|
||||
string configPath =
|
||||
$"Assets/Domain/{BuildAssetWindow.GetBuildPackageName()}/Conf/HotfixMainResDomain.asset";
|
||||
HotfixMainResDomain hotfixMainResDomain = AssetDatabase.LoadAssetAtPath<HotfixMainResDomain>(configPath);
|
||||
packageName = hotfixMainResDomain.hotfixMainResDomainEntity.domain;
|
||||
Mark();
|
||||
if(!BuildAssetWindow.GetBuildPackageName().Equals("Main"))
|
||||
CreateRes(packageName,
|
||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes",
|
||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/HotUpdate");
|
||||
if (!BuildAssetWindow.GetBuildPackageName().Equals("Main"))
|
||||
CreateRes(packageName,
|
||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes",
|
||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/HotUpdate");
|
||||
else
|
||||
CreateRes(packageName,
|
||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.main",
|
||||
"version": "1.0.22",
|
||||
"version": "1.0.30",
|
||||
"displayName": "00.StaryEvo",
|
||||
"description": "This is an Framework package",
|
||||
"unity": "2021.3",
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Stary.Evo.InformationSave
|
||||
|
||||
public abstract void Save(int index);
|
||||
public abstract void Switch(int index);
|
||||
|
||||
public virtual T GetTransform(string desc)
|
||||
{
|
||||
int index = _list.FindIndex(n => n.desc == desc);
|
||||
@@ -57,7 +58,12 @@ namespace Stary.Evo.InformationSave
|
||||
//更新
|
||||
public void UpdateInformation()
|
||||
{
|
||||
String sceneNmae = gameObject.scene.name;
|
||||
string guid = GetPrefabGUID(this.gameObject)+GetPrefabHierarchyPath(this.gameObject);
|
||||
if (guid == "")
|
||||
{
|
||||
UnityEditor.EditorUtility.DisplayDialog("错误", "可能存在错误\n1、无法在prefab预览中修改数据\n2、新增加物体需先同步为prefab", "确定");
|
||||
return;
|
||||
}
|
||||
ScriptObjectSave scriptObjectSaveData = Resources.Load<ScriptObjectSave>(path);
|
||||
if (scriptObjectSaveData == null)
|
||||
{
|
||||
@@ -65,14 +71,14 @@ namespace Stary.Evo.InformationSave
|
||||
return;
|
||||
}
|
||||
|
||||
if (scriptObjectSaveData.dic.ContainsKey(sceneNmae + gameObject.name))
|
||||
if (scriptObjectSaveData.dic.ContainsKey(guid))
|
||||
{
|
||||
_list.Clear();
|
||||
_list = scriptObjectSaveData.dic[sceneNmae + gameObject.name].OfType<T>().ToList();
|
||||
_list = scriptObjectSaveData.dic[guid].OfType<T>().ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("UnityEvo:ScriptObjectSaveData中未存储场景:"+ sceneNmae + " 中物体:" + gameObject.name + "的数据!!!");
|
||||
Debug.LogError($"UnityEvo:ScriptObjectSaveData中未存储物体名为:{this.gameObject}\n guid为:{guid}的数据!!!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,49 +86,53 @@ namespace Stary.Evo.InformationSave
|
||||
public bool PlayingSave()
|
||||
{
|
||||
//文件保存
|
||||
if (Application.isEditor)
|
||||
|
||||
string guid = GetPrefabGUID(this.gameObject)+GetPrefabHierarchyPath(this.gameObject);
|
||||
if (guid == "")
|
||||
{
|
||||
String sceneNmae = gameObject.scene.name;
|
||||
// 加载 ScriptObjectSaveData
|
||||
ScriptObjectSave scriptObjectSaveData = Resources.Load<ScriptObjectSave>(path);
|
||||
if(scriptObjectSaveData == null)
|
||||
{
|
||||
scriptObjectSaveData = CheckAndCreateFoldersAndAsset();
|
||||
//Debug.Log("创建了ScriptObjectSaveData文件");
|
||||
}
|
||||
UnityEditor.EditorUtility.DisplayDialog("错误", "可能存在错误\n1、无法在prefab预览中修改数据\n2、新增加物体需先同步为prefab", "确定");
|
||||
return false;
|
||||
}
|
||||
// 加载 ScriptObjectSaveData
|
||||
ScriptObjectSave scriptObjectSaveData = Resources.Load<ScriptObjectSave>(path);
|
||||
if (scriptObjectSaveData == null)
|
||||
{
|
||||
scriptObjectSaveData = CheckAndCreateFoldersAndAsset();
|
||||
//Debug.Log("创建了ScriptObjectSaveData文件");
|
||||
}
|
||||
|
||||
if (scriptObjectSaveData.dic == null)
|
||||
{
|
||||
Debug.LogError("UnityEvo:ScriptObjectSaveData的dic为空");
|
||||
return false;
|
||||
}
|
||||
if (scriptObjectSaveData.dic == null)
|
||||
{
|
||||
Debug.LogError("UnityEvo:ScriptObjectSaveData的dic为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查是否已经存在相同的键
|
||||
if (scriptObjectSaveData.dic.ContainsKey(sceneNmae + gameObject.name))
|
||||
// 检查是否已经存在相同的键
|
||||
if (scriptObjectSaveData.dic.ContainsKey(guid))
|
||||
{
|
||||
// 如果存在,选择是否替换原有的 List
|
||||
if (UnityEditor.EditorUtility.DisplayDialog("提示",
|
||||
$"数据集下已有相同名称的物体数据\n是否覆盖更新!!!\n 物体名为:{this.gameObject}\n guid为:{guid}", "确定",
|
||||
"取消"))
|
||||
{
|
||||
// 如果存在,选择是否替换原有的 List
|
||||
if (UnityEditor.EditorUtility.DisplayDialog("提示", "数据集下已有相同名称的物体数据\n是否覆盖更新!!!\n" + "场景名:" + sceneNmae + "\n物体名:" + gameObject.name, "确定", "取消"))
|
||||
{
|
||||
scriptObjectSaveData.dic[sceneNmae + gameObject.name] = new List<InformationBase>(_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
scriptObjectSaveData.dic[guid] = new List<InformationBase>(_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果不存在,添加新的键值对
|
||||
scriptObjectSaveData.dic.Add(sceneNmae + gameObject.name, new List<InformationBase>(_list));
|
||||
return false;
|
||||
}
|
||||
AssetDatabase.SaveAssets();
|
||||
EditorUtility.SetDirty(scriptObjectSaveData);
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果不存在,添加新的键值对
|
||||
scriptObjectSaveData.dic.Add(guid, new List<InformationBase>(_list));
|
||||
}
|
||||
|
||||
return false;
|
||||
AssetDatabase.SaveAssets();
|
||||
EditorUtility.SetDirty(scriptObjectSaveData);
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private ScriptObjectSave CheckAndCreateFoldersAndAsset()
|
||||
@@ -148,17 +158,19 @@ namespace Stary.Evo.InformationSave
|
||||
|
||||
// 创建ScriptObjectSaveData.asset文件
|
||||
scriptableObject = ScriptableObject.CreateInstance<ScriptObjectSave>();
|
||||
AssetDatabase.CreateAsset(scriptableObject, "Assets/" + ResourcesFolderName + "/" + InformationSaveDataFolderName + "/" + ScriptObjectSaveDataFileName + ".asset");
|
||||
AssetDatabase.CreateAsset(scriptableObject,
|
||||
"Assets/" + ResourcesFolderName + "/" + InformationSaveDataFolderName + "/" +
|
||||
ScriptObjectSaveDataFileName + ".asset");
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
Debug.Log("UnityEvo:创建了: " + "Assets/" + ResourcesFolderName + "/" + InformationSaveDataFolderName + "/" + ScriptObjectSaveDataFileName + ".asset 资产");
|
||||
Debug.Log("UnityEvo:创建了: " + "Assets/" + ResourcesFolderName + "/" + InformationSaveDataFolderName + "/" +
|
||||
ScriptObjectSaveDataFileName + ".asset 资产");
|
||||
return scriptableObject;
|
||||
}
|
||||
|
||||
//绘制
|
||||
public override void Draw()
|
||||
{
|
||||
|
||||
int length = _list.Count;
|
||||
int deleteIndex = -1;
|
||||
for (int i = 0; i < length; i++)
|
||||
@@ -209,6 +221,52 @@ namespace Stary.Evo.InformationSave
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private string GetCurrentGUID()
|
||||
{
|
||||
string assetPath = AssetDatabase.GetAssetPath(this);
|
||||
if (!string.IsNullOrEmpty(assetPath))
|
||||
{
|
||||
return AssetDatabase.AssetPathToGUID(assetPath);
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private string GetPrefabGUID(GameObject obj)
|
||||
{
|
||||
string assetPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(obj);
|
||||
Debug.Log("UnityEvo:GetPrefabHierarchyPath:" + GetPrefabHierarchyPath(obj));
|
||||
|
||||
if (!string.IsNullOrEmpty(assetPath))
|
||||
{
|
||||
return AssetDatabase.AssetPathToGUID(assetPath);
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
private string GetPrefabHierarchyPath(GameObject obj)
|
||||
{
|
||||
var path = new System.Text.StringBuilder();
|
||||
var current = obj.transform;
|
||||
//检测该预制体是否是实例
|
||||
var root = PrefabUtility.GetNearestPrefabInstanceRoot(obj);
|
||||
if (root != null)
|
||||
{
|
||||
while (current != null && current != root.transform)
|
||||
{
|
||||
path.Insert(0, current.name);
|
||||
path.Insert(0, "/");
|
||||
current = current.parent;
|
||||
}
|
||||
|
||||
|
||||
return path.ToString();
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
#else
|
||||
public override void Draw(){}
|
||||
@@ -217,6 +275,7 @@ namespace Stary.Evo.InformationSave
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class InformationBase
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "com.staryevo.informationsave",
|
||||
"displayName": "02.InformationSave",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "位置配置工具",
|
||||
"unity": "2021.3",
|
||||
"unityRelease": "30f1",
|
||||
|
||||
Reference in New Issue
Block a user