Skip to content

Commit efe8606

Browse files
committed
Added window which shows DllManipulatorEditor
Also fixed .gitignore on this branch
1 parent c4e00c1 commit efe8606

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.meta
1+
*.meta
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Linq;
2+
using UnityEngine;
3+
using UnityEditor;
4+
5+
namespace DllManipulator
6+
{
7+
public class DllManipulatorWindowEditor : EditorWindow
8+
{
9+
[MenuItem("UnityNativeTool/DLL Manipulator")]
10+
static void Init()
11+
{
12+
var window = GetWindow<DllManipulatorWindowEditor>();
13+
window.Show();
14+
}
15+
16+
void OnGUI()
17+
{
18+
var dllManipulator = FindObjectOfType<DllManipulator>();
19+
if (dllManipulator == null)
20+
{
21+
dllManipulator = Resources.FindObjectsOfTypeAll<DllManipulator>()
22+
.FirstOrDefault(d => !EditorUtility.IsPersistent(d) && d.gameObject.scene.IsValid());
23+
}
24+
25+
if (dllManipulator != null)
26+
{
27+
var editor = Editor.CreateEditor(dllManipulator);
28+
editor.OnInspectorGUI();
29+
}
30+
else
31+
{
32+
EditorGUILayout.Space();
33+
EditorGUILayout.LabelField($"There is no {nameof(DllManipulator)} script in the scene.");
34+
}
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)