-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuvimrc.cs
96 lines (80 loc) · 3.38 KB
/
uvimrc.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using UnityEditor;
using UnityEngine;
using System.Text.RegularExpressions;
using System.Reflection;
public class uvimrc : EditorWindow
{
// オブジェクトの共通Openコマンド
// [MenuItem("KeyRemap/Open &o")]
// static void KeyRemapOpen()
// {
// foreach (var aObj in Selection.objects)
// {
// var aObjPath = AssetDatabase.GetAssetPath(aObj);
// if (Regex.IsMatch(aObjPath, @"^.*\.unity")) { EditorApplication.OpenScene(aObjPath); }
// if (Regex.IsMatch(aObjPath, @"^.*\.cs")) { AssetDatabase.OpenAsset(aObj); }
// if (Regex.IsMatch(aObjPath, @"^.*\.prefab"))
// {
// PrefabUtility.InstantiatePrefab(aObj);
// CommonExecuteMenuItem("Window/Hierarchy");
// }
// }
// }
// ゲームオブジェクト作成
[MenuItem("KeyRemap/CreateGameObject #&e")]
static void KeyRemapCreateGameObject() { CommonExecuteMenuItem("GameObject/Create Empty"); }
// ゲームオブジェクトの削除
[MenuItem("KeyRemap/Delete #&d")]
static void KeyRemapDelete()
{
foreach (var aObj in Selection.objects)
{
GameObject aGameObject = aObj as GameObject;
if (aGameObject) { GameObject.DestroyImmediate(aGameObject); }
}
}
// ゲームオブジェクトの有効、無効
[MenuItem("KeyRemap/ActiveToggle #&t")]
static void KeyRemapActiveToggle()
{
foreach (var aObj in Selection.objects)
{
GameObject aGameObject = aObj as GameObject;
if (aGameObject) { aGameObject.SetActive(!aGameObject.activeSelf); }
}
}
// PrefabのApply
// [MenuItem("KeyRemap/PrefabApply &a")]
// static void KeyRemapPrefabApply() { CommonExecuteMenuItem("GameObject/Apply Changes To Prefab"); }
// コンソール出力のクリア
[MenuItem("KeyRemap/ClearConsoleLogs #&l")]
private static void ClearConsoleLogs()
{
string typeName = "UnityEditorInternal.LogEntries";
System.Type type = System.Reflection.Assembly.Load("UnityEditor").GetType(typeName);
var info = type.GetMethod("Clear", BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
info.Invoke(null, new object[0]);
}
// 再インポート
[MenuItem("KeyRemap/Reimport #&r")]
static void KeyRemapReimport() { CommonExecuteMenuItem("Assets/Reimport"); }
// フォーカス変更
[MenuItem("KeyRemap/Scene #&s")]
static void KeyRemapScene() { CommonExecuteMenuItem("Window/Scene"); }
[MenuItem("KeyRemap/Scene #&g")]
static void KeyRemapGame() { CommonExecuteMenuItem("Window/Game"); }
[MenuItem("KeyRemap/Inspector #&i")]
static void KeyRemapInspector() { CommonExecuteMenuItem("Window/Inspector"); }
[MenuItem("KeyRemap/Hierarchy #&h")]
static void KeyRemapHierarchy() { CommonExecuteMenuItem("Window/Hierarchy"); }
[MenuItem("KeyRemap/Project #&p")]
static void KeyRemapProject() { CommonExecuteMenuItem("Window/Project"); }
[MenuItem("KeyRemap/Animation #&a")]
static void KeyRemapAnimation() { CommonExecuteMenuItem("Window/Animation"); }
[MenuItem("KeyRemap/Console #&c")]
static void KeyRemapConsole() { CommonExecuteMenuItem("Window/Console"); }
static void CommonExecuteMenuItem(string iStr)
{
EditorApplication.ExecuteMenuItem(iStr);
}
}