Class TitleAttribute
Displays a decorative, bold title header immediately above the decorated field in the Unity Inspector, creating a named visual section without collapsible grouping behavior.
Inherited Members
Namespace: Scylla.Core.Attributes
Assembly: ScyllaCore.dll
Syntax
[AttributeUsage(AttributeTargets.Field)]
public sealed class TitleAttribute : PropertyAttribute
Remarks
The title is rendered as a large, bold label followed by an optional subtitle
in a smaller style. By default, a horizontal separator line is drawn below
the title text to visually anchor the section. The line can be suppressed
by setting ShowLine to false.
Unlike FoldoutAttribute, which groups fields under a
collapsible section, this attribute is purely decorative - all fields
beneath it remain permanently visible. Use TitleAttribute when the
logical grouping is clear from context and collapsibility is not needed,
or at the top of a prominent configuration block that should always be
expanded.
Use HorizontalLineAttribute alone when only a thin separator is needed without a label.
public class GameConfig : MonoBehaviour
{
/* Title with subtitle and default separator line */
[Title("Player Settings", "Configure player movement and health")]
[SerializeField] private float _playerHealth = 100f;
[SerializeField] private float _playerSpeed = 5f;
/* Title with separator but no subtitle */
[Title("Enemy Settings")]
[SerializeField] private float _enemyHealth = 50f;
/* Title without separator line */
[Title("Debug", ShowLine = false)]
[SerializeField] private bool _enableDebug = false;
}
Constructors
TitleAttribute(string)
Creates a section title header with the specified title text and no subtitle. A horizontal separator line is shown by default.
Declaration
public TitleAttribute(string title)
Parameters
| Type | Name | Description |
|---|---|---|
| string | title | The main title text to display as the section label. Must not be |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
TitleAttribute(string, string)
Creates a section title header with the specified title and subtitle text. A horizontal separator line is shown by default.
Declaration
public TitleAttribute(string title, string subtitle)
Parameters
| Type | Name | Description |
|---|---|---|
| string | title | The main title text to display as the section label. Must not be |
| string | subtitle | An optional secondary description rendered in a smaller style below the title.
Use this to provide a brief explanation of the section's purpose. May be
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
Properties
ShowLine
Gets or sets whether a horizontal separator line is drawn below the title (and subtitle, if present) to visually anchor the section header.
Declaration
public bool ShowLine { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Remarks
Defaults to true. Set to false to suppress the separator line
when a cleaner, label-only appearance is preferred or when immediately
following another decorator that already draws a line.
Subtitle
Gets the optional subtitle text displayed in a smaller style immediately below the main title.
Declaration
public string Subtitle { get; }
Property Value
| Type | Description |
|---|---|
| string | A secondary description string, or |
Title
Gets the main title text displayed as the section header.
Declaration
public string Title { get; }
Property Value
| Type | Description |
|---|---|
| string | A non-null, non-empty string set at construction time. Rendered as a large, bold label in the Inspector. |