- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
75 lines
2.4 KiB
C#
75 lines
2.4 KiB
C#
using UnityEngine;
|
|
using UnityEditor;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
public class FixMissingMeshes : MonoBehaviour
|
|
{
|
|
// 在Resources文件夹中加载所有的Mesh
|
|
private static Dictionary<string, Mesh> meshDictionary;
|
|
|
|
[MenuItem("Tools/Find Miss Meshes")]
|
|
private static void FindMissMesh()
|
|
{
|
|
GameObject[] allObjects = GameObject.FindObjectsOfType<GameObject>();
|
|
MeshFilter item = null;
|
|
foreach (GameObject obj in allObjects)
|
|
{
|
|
if (obj.TryGetComponent<MeshFilter>(out item))
|
|
{
|
|
if (item.sharedMesh == null)
|
|
{
|
|
Debug.Log(obj.name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
[MenuItem("Tools/Fix Missing Meshes")]
|
|
private static void FixMeshes()
|
|
{
|
|
// 初始化Mesh字典
|
|
LoadMeshes();
|
|
|
|
// 获取所有场景中的GameObject
|
|
GameObject[] allObjects = FindObjectsOfType<GameObject>();
|
|
|
|
foreach (GameObject obj in allObjects)
|
|
{
|
|
MeshFilter meshFilter = obj.GetComponent<MeshFilter>();
|
|
if (meshFilter != null && meshFilter.sharedMesh == null)
|
|
{
|
|
// 尝试根据名称从字典中获取Mesh
|
|
string meshName = obj.name;
|
|
if (meshDictionary.ContainsKey(meshName))
|
|
{
|
|
meshFilter.mesh = meshDictionary[meshName];
|
|
Debug.Log($"Fixed mesh for {obj.name}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* private static void LoadMeshes()
|
|
{
|
|
meshDictionary = new Dictionary<string, Mesh>();
|
|
string[] assetPaths = AssetDatabase.FindAssets("t:Mesh", new[] { "Assets" }); // 找到所有 Mesh 资产的路径
|
|
foreach (string assetPath in assetPaths)
|
|
{
|
|
string meshName = Path.GetFileNameWithoutExtension(AssetDatabase.GUIDToAssetPath(assetPath)); // 获取网格名称
|
|
Mesh mesh = AssetDatabase.LoadAssetAtPath<Mesh>(AssetDatabase.GUIDToAssetPath(assetPath)); // 加载网格
|
|
meshDictionary[meshName] = mesh;
|
|
}
|
|
} */
|
|
|
|
private static void LoadMeshes()
|
|
{
|
|
meshDictionary = new Dictionary<string, Mesh>();
|
|
Mesh[] meshes = Resources.LoadAll<Mesh>("");
|
|
foreach (Mesh mesh in meshes)
|
|
{
|
|
meshDictionary[mesh.name] = mesh;
|
|
}
|
|
}
|
|
}
|