// ╔════════════════════════════════════════════════════════════════╗
// ║ Copyright © 2025 NWH Coding d.o.o. All rights reserved. ║
// ║ Licensed under Unity Asset Store Terms of Service: ║
// ║ https://unity.com/legal/as-terms ║
// ║ Use permitted only in compliance with the License. ║
// ║ Distributed "AS IS", without warranty of any kind. ║
// ╚════════════════════════════════════════════════════════════════╝
#if UNITY_EDITOR
#region
using UnityEditor;
#endregion
namespace NWH.NUI
{
///
/// Base custom editor class for NWH NUI (NWH User Interface) system.
/// Provides common infrastructure for drawing foldable inspector sections with documentation links.
///
[CanEditMultipleObjects]
public class NUIEditor : Editor
{
///
/// NUIDrawer instance used to render inspector GUI.
///
public NUIDrawer drawer = new();
///
/// Unity callback to draw inspector GUI. Delegates to OnInspectorNUI.
///
public override void OnInspectorGUI()
{
OnInspectorNUI();
}
///
/// Draws custom NUI inspector. Override this method in derived classes to add custom GUI.
/// Initializes drawer and renders collapsible header.
///
/// True if header is expanded and GUI should continue, false if collapsed
public virtual bool OnInspectorNUI()
{
if (drawer == null)
{
drawer = new NUIDrawer();
}
drawer.documentationBaseURL = GetDocumentationBaseURL();
drawer.BeginEditor(serializedObject);
if (!drawer.Header(serializedObject.targetObject.GetType().Name))
{
drawer.EndEditor();
return false;
}
return true;
}
///
/// Gets base URL for documentation links. Override in derived classes to specify package-specific docs.
///
/// Base documentation URL
public virtual string GetDocumentationBaseURL()
{
return "http://nwhvehiclephysics.com";
}
///
/// Disables default Unity inspector margins for custom NUI layout control.
///
/// Always false to disable default margins
public override bool UseDefaultMargins()
{
return false;
}
}
}
#endif