【m】优化卸载加载逻辑
This commit is contained in:
@@ -1,76 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo.Editor
|
||||
{
|
||||
public class ChangePointClondMode
|
||||
{
|
||||
public static PointClondMode PointClondMode
|
||||
{
|
||||
get => _pointClondMode;
|
||||
set => SetPoindClondMode(value);
|
||||
}
|
||||
|
||||
private static PointClondMode _pointClondMode;
|
||||
|
||||
private const string EditorNotMode = "Evo/Schema/ChangePointClond/NotPointClond";
|
||||
private const string EditorImmersalMode = "Evo/Schema/ChangePointClond/Immersal";
|
||||
|
||||
[MenuItem(EditorNotMode)]
|
||||
private static void SetNotMode() => SetPoindClondMode(PointClondMode.NotPointClond);
|
||||
|
||||
[MenuItem(EditorImmersalMode)]
|
||||
private static void SetImmersalMode() => SetPoindClondMode(PointClondMode.Immersal);
|
||||
|
||||
// [MenuItem(WebPlayMode)]
|
||||
// private static void SetWebMode() => SetPlayerMode(HotUpdateMode.WEB_PLAYMODE);
|
||||
|
||||
[MenuItem(EditorNotMode, true)]
|
||||
private static bool ValidateModeMenu()
|
||||
{
|
||||
string platform = CustomEditorPrefs.GetString("ChangePoindClondSchema");
|
||||
Menu.SetChecked(EditorNotMode, platform == PointClondMode.NotPointClond.ToString());
|
||||
Menu.SetChecked(EditorImmersalMode, platform == PointClondMode.Immersal.ToString());
|
||||
//Menu.SetChecked(WebPlayMode, platform == HotUpdateMode.WEB_PLAYMODE.ToString());
|
||||
Debug.Log($"ChangePoindClondSchema:{platform}");
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void SetPoindClondMode(PointClondMode mode)
|
||||
{
|
||||
// 清除所有旧模式定义
|
||||
var currentTarget = EditorUserBuildSettings.selectedBuildTargetGroup;
|
||||
if (currentTarget == BuildTargetGroup.Unknown) return;
|
||||
|
||||
var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(currentTarget)
|
||||
.Split(';')
|
||||
.Where(d => !Enum.GetNames(typeof(HotUpdateMode)).Contains(d))
|
||||
.ToList();
|
||||
|
||||
// 添加新模式
|
||||
defines.Add(mode.ToString());
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(currentTarget, string.Join(";", defines));
|
||||
_pointClondMode = mode;
|
||||
CustomEditorPrefs.SetString("ChangePoindClondSchema", _pointClondMode.ToString());
|
||||
|
||||
ValidateModeMenu();
|
||||
AssetDatabase.Refresh();
|
||||
// 添加解决方案文件重新生成逻辑
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation();
|
||||
Debug.Log($"当前编译符号: {string.Join(";", defines)}"); // 添加调试日志
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public enum PointClondMode
|
||||
{
|
||||
//非点云模式,
|
||||
NotPointClond,
|
||||
//Immersal模式
|
||||
Immersal,
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 076111eb4cfd413287c1d7f299fe5a1f
|
||||
timeCreated: 1757471872
|
||||
Reference in New Issue
Block a user