internal static ToolboxPropertyHandler GetPropertyHandler(SerializedProperty property) { var key = property.GetPropertyKey(); if (!propertyHandlers.TryGetValue(key, out ToolboxPropertyHandler propertyHandler)) { return(propertyHandlers[key] = propertyHandler = new ToolboxPropertyHandler(property)); } return(propertyHandler); }
/// <summary> /// Returns and/or creates (if needed) <see cref="ToolboxPropertyHandler"/> for given property. /// </summary> internal static ToolboxPropertyHandler GetPropertyHandler(SerializedProperty property) { if (InspectorUtility.InToolboxEditor) { //NOTE: maybe type-based key? var propertyKey = property.GetPropertyHashKey(); if (propertyHandlers.TryGetValue(propertyKey, out var propertyHandler)) { return(propertyHandler); } else { return(propertyHandlers[propertyKey] = new ToolboxPropertyHandler(property)); } } else { ToolboxEditorLog.LogWarning("Do not use Toolbox-related drawers outside ToolboxEditor."); return(null); } }