Developer API
The general-purpose classes used inside the package can also be used from outside.
ReflectionDelegateFactory
A factory that generates fast access delegates to Unity's internal APIs. It is based on Expression Trees and supports methods / property accessors (with automatic get_ / set_ fallback) / field reads and writes / constructor calls.
// インスタンスメソッド
var del = ReflectionDelegateFactory.Create<Action<object>>(
"UnityEditor.Graphs.ParameterControllerView", "DeleteParameter");
// プロパティ getter
var getter = ReflectionDelegateFactory.Create<Func<object, AnimatorController>>(
"UnityEditor.Graphs.IAnimatorControllerEditor", "animatorController");
// 静的メソッド (out 引数 OK)
public delegate bool TryGetFolderPathDelegate(out string path);
var f = ReflectionDelegateFactory.Create<TryGetFolderPathDelegate>(
"UnityEditor.ProjectWindowUtil", "TryGetActiveFolderPath");
// フィールド getter / setter
var fg = ReflectionDelegateFactory.CreateFieldGetter<object>(
"UnityEditor.Graphs.ParameterControllerView", "m_Host");
var fs = ReflectionDelegateFactory.CreateFieldSetter<int>(
"UnityEditor.Graphs.LayerControllerView", "m_SelectedIndex");
// 引数なしコンストラクタ
var ctor = ReflectionDelegateFactory.CreateConstructor<Func<object>>(
"UnityEditor.Graphs.LayerControllerView");
var instance = ctor();When a member is not found
If the member cannot be found, Create<TDelegate> reports Member not found: <member> in <class> via LogError. This gives you a clue when investigating a delegate that suddenly became null because of a Unity version difference.
Generated delegates are not cached
When used in a hot path (such as every frame), cache the generated delegate on the caller side. Not supported: instantiating generic methods, out / ref arguments on instance methods (static methods are supported), and explicit selection when a void method and a setter with the same name collide.
New Hierarchy Column Registration API
You can add custom columns to the New Hierarchy Window with the [SCEHierarchyColumn] attribute.
Extension Methods
| Class | Main uses |
|---|---|
AnimatorExtensions | GetAllStates / GetAllStatePairs / GetAllTransitions / AddLayerEx / PasteLayer / CloneObject |
ColorExtensions | Hex → Color conversion (HexToColor) |
ComponentExtensions | Component reference check (IsComponentReferenced) |
EditorWindowExtensions | GetDockAreaWindows / RepaintEditor / extended GetWindow |
GameObjectExtensions | Batch retrieval of descendant components |
GUIExtensions | ToggleSafe / SliderSafe / Foldout / DrawHorizontalLine |
ModularAvatarExtensions | GetParameterInfos / GetParameterBits |
PathUtils | Absolute path ↔ Asset path conversion |
Other Useful Classes
InputKeyChecker— Global key input events inside the Unity EditorComponentPropertyWindowOpener— Opens any component in its own floating property windowSearchComponentDropdown— Hierarchical component search UI based on theAddComponentMenuattributeCallerUtils— Gets the caller'sType