kingBook

导航

随笔分类 -  Unity Editor 2

Unity 二维数组序列化
摘要:unity 中,二维以上的数量是不支持序列化的,如: using System.Collections.Generic; using UnityEngine; public class TestArray : MonoBehaviour { // 不支持序列化(在Inspector面板无法显示) p 阅读全文

posted @ 2024-10-07 22:07 kingBook 阅读(59) 评论(0) 推荐(0) 编辑

Unity Editor 保存图片、缩放纹理
摘要:using System.IO; using UnityEditor; using UnityEngine; public class ConvertIconToMultipleSizes : Editor { [MenuItem("Assets/Convert Icon To Multiple S 阅读全文

posted @ 2024-08-16 16:03 kingBook 阅读(7) 评论(0) 推荐(0) 编辑

Unity 创建一个规范的Package
摘要:为包命名 xxx.xxx.xxx...@v.v.v (字母要小写,@后是包版本号) 包的布局 Packages ├── package.json ├── README.md ├── CHANGELOG.md ├── LICENSE.md ├── Third Party Notices.md ├── 阅读全文

posted @ 2024-06-08 08:17 kingBook 阅读(59) 评论(0) 推荐(0) 编辑

UnityEditor Undo
摘要:最重要的几项操作如下所述: 修改单个属性: Undo.RecordObject (myGameObject.transform, "Zero Transform Position"); myGameObject.transform.position = Vector3.zero; 添加组件: Und 阅读全文

posted @ 2022-08-26 14:00 kingBook 阅读(76) 评论(0) 推荐(0) 编辑

UnityEditor 查找和获取内置资源
摘要:Object[] UnityAssets = AssetDatabase.LoadAllAssetsAtPath("Resources/unity_builtin_extra"); foreach (var asset in UnityAssets) { Debug.Log(asset); } De 阅读全文

posted @ 2022-08-26 12:22 kingBook 阅读(174) 评论(0) 推荐(0) 编辑

UnityEditor 获取FileID/LocalIdentfierInFile
摘要:private static int GetLocalIdentfierInFile(UnityEngine.Object obj) { PropertyInfo info = typeof(SerializedObject).GetProperty("inspectorMode", Binding 阅读全文

posted @ 2022-08-23 17:46 kingBook 阅读(313) 评论(0) 推荐(0) 编辑

Unity Editor 使文本输入框失去焦点
摘要:GUIUtility.keyboardControl = 0; 阅读全文

posted @ 2022-07-17 17:44 kingBook 阅读(160) 评论(0) 推荐(0) 编辑

Unity Editor 复制内容到剪切板
摘要:string str="acd12335"; TextEditor textEditor = new TextEditor(); textEditor.text = str; textEditor.SelectAll(); textEditor.Copy(); 阅读全文

posted @ 2022-07-17 16:50 kingBook 阅读(134) 评论(0) 推荐(0) 编辑

UnityEditor 编辑器脚本执行菜单
摘要:例:执行 Edit/Duplicate 菜单 [MenuItem("Tools/Duplicate")] private static void ExecuteDuplicate() { bool isExecute = EditorApplication.ExecuteMenuItem("Edit 阅读全文

posted @ 2022-06-19 18:09 kingBook 阅读(124) 评论(0) 推荐(0) 编辑

Unity Editor Hierarchy下拉菜单扩展
摘要:TestHierarchyPopupMenuEditor.cs using UnityEditor; using UnityEngine; public class TestHierarchyPopupMenuEditor : ScriptableObject { [MenuItem("GameOb 阅读全文

posted @ 2022-04-20 17:45 kingBook 阅读(414) 评论(0) 推荐(0) 编辑