Custom inspector for LoggerConfig.
More...
|
| override void | OnInspectorGUI () |
| | Renders the custom inspector UI and applies serialized changes once.
|
| |
|
| static bool | IsSymbolDefined (string symbol) |
| | Checks whether a scripting define symbol is present for the current build target group.
|
| |
| static void | AddSymbol (string symbol) |
| | Adds a scripting define symbol to the current build target group if missing.
|
| |
| static void | RemoveSymbol (string symbol) |
| | Removes a scripting define symbol from the current build target group if present.
|
| |
Custom inspector for LoggerConfig.
Provides:
- Global log level and color mode controls.
- Category list with per-item toggle, name, color, and delete.
- Optional grouping by category prefix (e.g., "Menu.UI" -> group "Menu").
- Delete-whole-group with confirmation.
- Import/Merge categories from another LoggerConfig (Keep or Overwrite).
- Toggle for the ENABLE_LOGGING scripting define.
- Note
- Applies serialized changes exactly once at the end of OnInspectorGUI to keep IMGUI stable, except when confirming destructive operations where an early Apply is required before ExitGUI.
◆ AddSymbol()
| static void Backbone::LoggerConfigEditor::AddSymbol |
( |
string | symbol | ) |
|
|
staticprivate |
Adds a scripting define symbol to the current build target group if missing.
- Parameters
-
| symbol | The define symbol to add. |
◆ DrawCategoriesGroupedByPrefix()
| void Backbone::LoggerConfigEditor::DrawCategoriesGroupedByPrefix |
( |
| ) |
|
|
private |
Draws categories grouped by the segment before the first '.' in their name.
- Builds a map of prefix -> indices in the categories array.
- Shows a tri-state group toggle (mixed when some but not all are active).
- Clicking the group toggle assigns the same active state to all children.
- Provides a Delete Group button with confirmation, removing all children safely.
- Renders each child row via DrawCategoryRow; no mid-frame Apply calls.
- Note
- No ApplyModifiedProperties() here; it is deferred to OnInspectorGUI, except when confirming deletion.
◆ DrawCategoryRow()
| void Backbone::LoggerConfigEditor::DrawCategoryRow |
( |
SerializedProperty | element, |
|
|
int | index ) |
|
private |
Draws a single category row.
- Parameters
-
| element | SerializedProperty pointing to the category struct/object. |
| index | Index of the category in the categories array (used for deletion). |
Row layout:
- Toggle (bound to 'active' via PropertyField for IMGUI stability)
- Editable name (TextField)
- Color picker (PropertyField)
- Delete button (removes array element and exits GUI)
- Note
- No ApplyModifiedProperties() is called here.
◆ ImportCategoriesFrom()
| void Backbone::LoggerConfigEditor::ImportCategoriesFrom |
( |
LoggerConfig | src, |
|
|
bool | overwriteExisting ) |
|
private |
Merge categories from another LoggerConfig without clearing current ones.
- Parameters
-
| src | Source LoggerConfig asset. |
| overwriteExisting | If true, overwrite 'active' and 'color' for same-name entries; otherwise keep current. |
Reads the source via SerializedObject to avoid requiring public access on the ScriptableObject. New categories are appended; existing names are kept or overwritten based on the flag.
◆ IsSymbolDefined()
| static bool Backbone::LoggerConfigEditor::IsSymbolDefined |
( |
string | symbol | ) |
|
|
staticprivate |
Checks whether a scripting define symbol is present for the current build target group.
- Parameters
-
| symbol | The define symbol to check (e.g., "ENABLE_LOGGING"). |
- Returns
- True if present, false otherwise.
◆ OnEnable()
| void Backbone::LoggerConfigEditor::OnEnable |
( |
| ) |
|
|
private |
Unity callback to cache SerializedProperty references.
Finds and stores references to:
- globalLevel
- categories
- colorMode
- groupByPrefix
◆ OnInspectorGUI()
| override void Backbone::LoggerConfigEditor::OnInspectorGUI |
( |
| ) |
|
Renders the custom inspector UI and applies serialized changes once.
- Draws ENABLE_LOGGING define toggle and forces domain reload on change.
- Draws global level and color mode fields.
- Draws grouping toggle and either a grouped or flat category list.
- Handles add, delete, and restore-defaults actions.
- Provides Import/Merge from another LoggerConfig (Keep or Overwrite).
- Note
- Uses UpdateIfRequiredOrScript()/ApplyModifiedProperties() once to keep IMGUI consistent.
◆ RemoveSymbol()
| static void Backbone::LoggerConfigEditor::RemoveSymbol |
( |
string | symbol | ) |
|
|
staticprivate |
Removes a scripting define symbol from the current build target group if present.
- Parameters
-
| symbol | The define symbol to remove. |
Also cleans up duplicate separators and trims trailing semicolons.
◆ categoriesProp
| SerializedProperty Backbone::LoggerConfigEditor::categoriesProp |
|
private |
◆ colorModeProp
| SerializedProperty Backbone::LoggerConfigEditor::colorModeProp |
|
private |
◆ globalLevelProp
| SerializedProperty Backbone::LoggerConfigEditor::globalLevelProp |
|
private |
◆ groupByPrefixProp
| SerializedProperty Backbone::LoggerConfigEditor::groupByPrefixProp |
|
private |
◆ importSource
| LoggerConfig Backbone::LoggerConfigEditor::importSource = null |
|
private |
Source asset used to import/merge categories (editor-only, not serialized).
◆ newCategoryName
| string Backbone::LoggerConfigEditor::newCategoryName = "" |
|
private |
Temporary buffer for the “add category” text field.
◆ SYMBOL
| const string Backbone::LoggerConfigEditor::SYMBOL = "ENABLE_LOGGING" |
|
private |
Scripting define used to include logger calls in builds.
The documentation for this class was generated from the following file: