Adding Your Own Tools
Your custom tools can be searched, favorited, and used via the Rhu Editor interface.
Rhu Editor is under active development. Some information may be incomplete or out of date.
Your custom tools can be searched, favorited, and used via the Rhu Editor interface.
Rhu Editor supports user-made tools via an easy to use plugin system. At startup, tools are found, sorted, and cached for later use. All tools are drawn as window contents within the Rhu Editor interface.
Use the information below to add your own tools to Rhu Editor.
This attribute is used to determine which classes can be accessed by Rhu Editor as layouts.
public RhuEditorLayoutAttribute(string layoutKey, string layoutTitle, string toolInfo = "", string[] keyWords = null, Toolkits toolkit = Toolkits.None, string guiMethod = "RE_GUI", bool excludeFromSearch = false)
layoutKey
layoutTitle
toolInfo
keyWords
toolKit
guiMethod
excludeFromSearch
Unique identifier for the layout.
Display name of the layout.
Optional tool-related info; viewable when hovering over the layout's title.
Optional array of keywords; allows layout to quickly be found via search.
Optional enum indicating which toolkit the layout should be sorted into. Available toolkits: Object, Project, Serializer, Debugging, Other
Name of the method Rhu Editor calls when displaying the layout's content. Method must be both public and static.
If true, the layout will not be included with search results. This is typically reserved for Main Pages.
The following example demonstrates how to properly integrate a custom tool into Rhu Editor.
The script for your tool must reside within an "Editor" directory.
Your tool implements a public static GUI method, or your tool can implement a non-static helper method that calls a public static GUI method.
NOTE: If your tool exists as an editor window, you must implement a helper method (details below).
Rhu Editor hasn't found any debugging tools. Let's add one.
Note that this tool is located within a folder named "Editor".
This tool is an editor window with a label and a clickable button. When clicked, the button prints "Click!" to the console.
Below is the source code for this tool:
using UnityEditor;
using UnityEngine;
public class MyTool : EditorWindow
{
[MenuItem("Window/My Tool")]
public static void OpenWindow()
{
GetWindow(typeof(MyTool), false, "My Tool");
}
public void OnGUI()
{
GUILayout.Label("Click My Button!", EditorStyles.whiteBoldLabel);
GUILayout.Space(10);
if (GUILayout.Button("My Button"))
{
Debug.Log("Cick!");
}
}
}
In order for this tool to be accessible via Rhu Editor, the RhuEditorLayout attribute must be added:
using UnityEditor;
using UnityEngine;
[RhuEditorLayout("MyTool", "My Tool", "A cool new tool.", new string[]{"new", "tool"}, Toolkits.Debugging)]
public class MyTool : EditorWindow
{
[MenuItem("Window/My Tool")]
public static void OpenWindow()
{
GetWindow(typeof(MyTool), false, "My Tool");
}
public void OnGUI()
{
GUILayout.Label("Click My Button!", EditorStyles.whiteBoldLabel);
GUILayout.Space(10);
if (GUILayout.Button("My Button"))
{
Debug.Log("Cick!");
}
}
}
By adding the RhuEditorLayout attribute, the tool is now discoverable by Rhu Editor; though the contents of the tool won't be drawn by Rhu Editor.
Rhu Editor requires a static method to draw GUI content. If your tool exists as an editor window like in this example, it is not possible to use OnGUI since the method must be non-static. To use the tool both within Rhu Editor and as a standalone editor window, OnGUI must be used as a helper method:
using UnityEditor;
using UnityEngine;
[RhuEditorLayout("MyTool", "My Tool", "A cool new tool.", new string[]{"new", "tool"}, Toolkits.Debugging)]
public class MyTool : EditorWindow
{
[MenuItem("Window/My Tool")]
public static void OpenWindow()
{
GetWindow(typeof(MyTool), false, "My Tool");
}
public void OnGUI()
{
RE_GUI();
}
public static void RE_GUI()
{
GUILayout.Label("Click My Button!", EditorStyles.whiteBoldLabel);
GUILayout.Space(10);
if (GUILayout.Button("My Button"))
{
Debug.Log("Cick!");
}
}
}
The tool is now accessible within Rhu Editor. It is fully functional, can be favorited, found by search, or updated like any other built-in tool. It also remains as a standalone editor window.
NOTE: The default GUI method name is RE_GUI. If you would like to use a different method name, ensure the guiMethod parameter of the tool's RhuEditorLayout attribute matches.
This code provides an example.
If your tool is not a standalone editor window, or is written with the purpose of being a Rhu Editor layout, you can simply define a static GUI method for Rhu Editor to use:
using UnityEditor;
using UnityEngine;
[RhuEditorLayout("MyTool", "My Tool", "A cool new tool.", new string[]{"new", "cool", "tool"}, Toolkits.Debugging, "MyGUI")]
public class MyTool
{
public static void MyGUI()
{
GUILayout.Label("Click My Button!", EditorStyles.whiteBoldLabel);
GUILayout.Space(10);
if (GUILayout.Button("My Button"))
{
Debug.Log("Cick!");
}
}
}