> For the complete documentation index, see [llms.txt](https://dante-3.gitbook.io/dante-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dante-3.gitbook.io/dante-docs/indicator-system-plugin/api-references.md).

# API References

## UIndicatorManagerComponent

The **entry point** for the indicator system on any actor. Add this component to any actor you want to display an indicator for.

```cpp
UCLASS(BlueprintType, Blueprintable, meta=(BlueprintSpawnableComponent))
class UIndicatorManagerComponent : public UActorComponent
```

### Key Property

```cpp
UPROPERTY(EditAnywhere, Category="Indicator Manager Component", meta=(ExposedOnSpawn=true))
UIndicatorSetupConfig* IndicatorSetupConfig;
```

Assign a `UIndicatorSetupConfig` data asset here. All setup actions in that asset run during `BeginPlay`.

### Key Methods

| Method                                   | Description                                        |
| ---------------------------------------- | -------------------------------------------------- |
| `static GetComponent(AActor*)`           | Find the `UIndicatorManagerComponent` on any actor |
| `AddIndicator(UIndicatorDescriptor*)`    | Manually register an additional descriptor         |
| `RemoveIndicator(UIndicatorDescriptor*)` | Unregister a descriptor                            |
| `GetIndicators()`                        | Returns all active descriptors on this component   |

### Events

| Event                | Fires When                                       |
| -------------------- | ------------------------------------------------ |
| `OnIndicatorAdded`   | A descriptor is added (C++ multicast delegate)   |
| `OnIndicatorRemoved` | A descriptor is removed (C++ multicast delegate) |

### Lifecycle

**`BeginPlay`:**

1. Creates a `UIndicatorDescriptor`
2. Detects actor type — sets `SceneComponent` to `UCapsuleComponent` (characters) or `RootComponent` (others)
3. Runs all `UIndicatorSetupActions` from `IndicatorSetupConfig` on the descriptor
4. Registers with `UIndicatorSubsystem`

**`EndPlay`:**

1. Fires `OnIndicatorSetupDeactivated` on all actions
2. Unregisters from `UIndicatorSubsystem`

> **Warning:** If `IndicatorSetupConfig` is `nullptr` at `BeginPlay`, no descriptor is created. Ensure the config is always assigned.

## UIndicatorDescriptor

The **runtime state object** for a single active indicator. Created automatically by `UIndicatorManagerComponent` but can also be created manually for dynamic indicators.

```cpp
UCLASS(BlueprintType)
class UIndicatorDescriptor : public UObject
```

### Content / Targeting

| Method                                                                | Description                                                       |
| --------------------------------------------------------------------- | ----------------------------------------------------------------- |
| `GetDataObject() / SetDataObject(UObject*)`                           | Arbitrary payload object (actor, item, etc.) passed to the widget |
| `GetSceneComponent() / SetSceneComponent(USceneComponent*)`           | World-space source for projection                                 |
| `GetComponentSocketName() / SetComponentSocketName(FName)`            | Optional socket on the component                                  |
| `GetIndicatorClass() / SetIndicatorClass(TSoftClassPtr<UUserWidget>)` | Widget class to spawn and display                                 |

### Visibility

| Method                                                   | Description                                               |
| -------------------------------------------------------- | --------------------------------------------------------- |
| `GetIsVisible()`                                         | `true` if scene component is valid AND `bVisible` is true |
| `SetDesiredVisibility(bool)`                             | Show or hide this indicator                               |
| `GetMaxVisibleDistance() / SetMaxVisibleDistance(float)` | Max distance in cm (0 = unlimited)                        |
| `GetMinVisibleDistance() / SetMinVisibleDistance(float)` | Min distance in cm (0 = no minimum)                       |

### Position & Alignment

| Method                                                                | Description                                   |
| --------------------------------------------------------------------- | --------------------------------------------- |
| `GetProjectionMode() / SetProjectionMode(EActorCanvasProjectionMode)` | How world pos is computed                     |
| `GetHAlign() / SetHAlign(EHorizontalAlignment)`                       | Horizontal anchor relative to projected point |
| `GetVAlign() / SetVAlign(EVerticalAlignment)`                         | Vertical anchor relative to projected point   |
| `GetWorldPositionOffset() / SetWorldPositionOffset(FVector)`          | Offset in world space before projection       |
| `GetScreenSpaceOffset() / SetScreenSpaceOffset(FVector2D)`            | Offset applied after projection (pixels)      |
| `GetBoundingBoxAnchor() / SetBoundingBoxAnchor(FVector)`              | Normalized anchor within bounding box (0–1)   |

### Screen-Edge Clamping

| Method                                                          | Description                            |
| --------------------------------------------------------------- | -------------------------------------- |
| `GetClampToScreen() / SetClampToScreen(bool)`                   | Lock to screen edge when off-screen    |
| `GetShowClampToScreenArrow() / SetShowClampToScreenArrow(bool)` | Show directional arrow when clamped    |
| `GetArrowBrush() / SetArrowBrush(FSlateBrush)`                  | Custom arrow brush for this descriptor |

### Size & Scale

| Method                                                    | Description                               |
| --------------------------------------------------------- | ----------------------------------------- |
| `GetOverrideDesiredSize() / SetOverrideDesiredSize(bool)` | Force a specific widget size              |
| `GetDesiredSize() / SetDesiredSize(FVector2D)`            | Override size in pixels (default 100×100) |
| `GetScale() / SetScale(float)`                            | Uniform scale multiplier                  |
| `GetScale2D() / SetScale2D(FVector2D)`                    | Per-axis scale (X, Y independently)       |

### Priority & Overlap

| Method                                               | Description                                              |
| ---------------------------------------------------- | -------------------------------------------------------- |
| `GetPriority() / SetPriority(int32)`                 | Render order (higher = drawn on top, sorted after depth) |
| `GetPreventOverlap() / SetPreventOverlap(bool)`      | Prevent overlapping with other indicators                |
| `GetOverlapPadding() / SetOverlapPadding(FVector2D)` | Extra pixel padding for overlap detection                |

### Lifecycle

| Method                                                                                          | Description                                                    |
| ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `UnregisterIndicator()`                                                                         | Removes this descriptor from `UIndicatorSubsystem` immediately |
| `GetAutoRemoveWhenIndicatorComponentIsNull() / SetAutoRemoveWhenIndicatorComponentIsNull(bool)` | Auto-remove when the scene component becomes invalid           |
| `CanAutomaticallyRemove()`                                                                      | Returns true if auto-remove is on and component is invalid     |

### Default Property Values

| Property                                  | Default           |
| ----------------------------------------- | ----------------- |
| `bVisible`                                | `true`            |
| `bClampToScreen`                          | `false`           |
| `bShowClampToScreenArrow`                 | `false`           |
| `bAutoRemoveWhenIndicatorComponentIsNull` | `false`           |
| `ProjectionMode`                          | `ComponentPoint`  |
| `HAlignment`                              | `HAlign_Center`   |
| `VAlignment`                              | `VAlign_Center`   |
| `Priority`                                | `0`               |
| `BoundingBoxAnchor`                       | `(0.5, 0.5, 0.5)` |
| `DesiredSize`                             | `(100, 100)`      |
| `Scale`                                   | `1.0`             |
| `Scale2D`                                 | `(1.0, 1.0)`      |
| `MaxVisibleDistance`                      | `0` (unlimited)   |
| `MinVisibleDistance`                      | `0` (none)        |
| `OverlapPadding`                          | `(5, 5)`          |

## EActorCanvasProjectionMode

Controls how the indicator's 2D screen position is computed from the 3D world.

```cpp
enum class EActorCanvasProjectionMode : uint8
{
    ComponentPoint,              // Project the component's pivot point
    ComponentBoundingBox,        // Project based on the component's world bounding box
    ComponentScreenBoundingBox,  // Use the component's bounding box in screen space
    ActorBoundingBox,            // Project based on the entire actor's world bounding box
    ActorScreenBoundingBox       // Use the entire actor's bounding box in screen space
};
```

| Mode                         | Best For                                  |
| ---------------------------- | ----------------------------------------- |
| `ComponentPoint`             | Static props, simple markers              |
| `ComponentBoundingBox`       | Characters, large meshes                  |
| `ComponentScreenBoundingBox` | Precise screen-fitting (performance cost) |
| `ActorBoundingBox`           | Multi-component actors                    |
| `ActorScreenBoundingBox`     | Full-actor screen-space precision         |

## UIndicatorSubsystem

The **global registry** of all active indicators. A `UGameInstanceSubsystem` — one instance per game session.

```cpp
UCLASS(Blueprintable, DisplayName="Indicator Manager Subsystem")
class UIndicatorSubsystem : public UGameInstanceSubsystem
```

Access from anywhere:

```cpp
UIndicatorSubsystem* IndicatorSub =
    GetGameInstance()->GetSubsystem<UIndicatorSubsystem>();
```

### Key Methods

| Method                                                       | Description                                                  |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| `GetIndicatorManagerForPlayer(APlayerController*)`           | Returns the `UIndicatorManagerComponent` for a player's pawn |
| `GetActiveIndicatorSetupConfig(UIndicatorManagerComponent*)` | Returns the config asset used by a manager                   |
| `AddIndicatorForActor(AActor*, UIndicatorDescriptor*)`       | Manually register an actor→descriptor pair                   |
| `RemoveIndicatorForActor(AActor*)`                           | Remove an actor's indicator registration                     |
| `IsIndicatorActiveForActor(AActor*)`                         | Check if an actor has an active indicator                    |
| `FindIndicatorDescriptorByActor(AActor*)`                    | Get descriptor for a given actor                             |
| `FindIndicatorActorByDescriptor(UIndicatorDescriptor*)`      | Reverse lookup — actor from descriptor                       |
| `GetActiveIndicators()`                                      | Returns copy of full `TMap<AActor*, UIndicatorDescriptor*>`  |
| `GetRegisteredIndicatorsMap()`                               | Returns const reference to internal map (C++ only)           |
| `ClearAllIndicators()`                                       | Removes all registrations                                    |
| `GetArrowBrush()`                                            | Returns arrow brush from the first active indicator          |

### C++ Delegates

```cpp
FOnIndicatorManagerRegistered   OnIndicatorManagerRegistered;   // (AActor*, UIndicatorManagerComponent*)
FOnIndicatorManagerUnregistered OnIndicatorManagerUnregistered; // (AActor*, UIndicatorManagerComponent*)
```

## UIndicatorLayer

The **render widget** that displays all active indicators. Add one instance to your HUD, full-screen.

```cpp
UCLASS()
class UIndicatorLayer : public UWidget
```

### Key Property

```cpp
UPROPERTY(EditAnywhere)
FSlateBrush ArrowBrush;  // Default arrow brush for clamped indicators
```

### Usage

1. In your HUD UMG Blueprint, add a `UIndicatorLayer` widget
2. Set its anchors to stretch full screen (0,0 → 1,1)
3. Assign a default `ArrowBrush` if desired

No further code is needed — the layer automatically queries `UIndicatorSubsystem` and renders all registered indicators each frame via `SActorCanvas`.

## IActorIndicatorWidget (IIndicatorWidgetInterface)

Interface for indicator UMG widgets to receive descriptor data.

```cpp
class IActorIndicatorWidget
```

### Methods to Implement

```cpp
// Called when the indicator is first bound to this widget
void BindIndicator(UIndicatorDescriptor* Indicator);

// Called when the indicator is removed or cleaned up
void UnbindIndicator(const UIndicatorDescriptor* Indicator);
```

In `BindIndicator`, cast `Indicator->GetDataObject()` to your expected type to access the target actor, item, or any custom payload.

### Blueprint Implementation

1. Open your indicator widget Blueprint
2. Go to **Class Settings → Implemented Interfaces** → add `IActorIndicatorWidget`
3. Override **Bind Indicator** and **Unbind Indicator** events

```
Bind Indicator →
    Cast DataObject to BP_Enemy
    Set EnemyRef variable
    Update HP bar text
```

## UIndicatorLibrary

Blueprint function library with convenience helpers.

```cpp
class UIndicatorLibrary : public UBlueprintFunctionLibrary
```

| Function                                | Description                                                         |
| --------------------------------------- | ------------------------------------------------------------------- |
| `GetIndicatorManagerComponent(AActor*)` | Returns the `UIndicatorManagerComponent` on an actor (or `nullptr`) |

## UIndicatorSetupConfig

The **configuration data asset**. Create one asset per indicator type (enemy, objective, item, etc.).

```cpp
UCLASS(Blueprintable, BlueprintType)
class UIndicatorSetupConfig : public UPrimaryDataAsset
```

### Key Property

```cpp
UPROPERTY(EditDefaultsOnly, Instanced, BlueprintReadOnly)
TArray<UIndicatorSetupActions*> Configs;
```

Actions in the array are executed **in order** during `BeginPlay`. Each action configures one aspect of the descriptor. Actions are `EditInlineNew` + `Instanced` so they are embedded directly in the Data Asset and editable in the Details panel.

## UIndicatorSetupActions (Abstract Base)

Base class for all setup actions.

```cpp
UCLASS(Abstract, Blueprintable, DefaultToInstanced, EditInlineNew)
class UIndicatorSetupActions : public UObject
```

### Override Interface

```cpp
// Called at BeginPlay — configure the descriptor here
virtual void OnIndicatorSetupActivated_Implementation(
    UIndicatorManagerComponent* IndicatorManager,
    UIndicatorDescriptor*       Descriptor
);

// Called at EndPlay — clean up any side effects here
virtual void OnIndicatorSetupDeactivated_Implementation(
    UIndicatorManagerComponent* IndicatorManager,
    UIndicatorDescriptor*       Descriptor
);
```

### Cached References (Available Inside Overrides)

| Property                 | Set At                               |
| ------------------------ | ------------------------------------ |
| `CachedIndicatorManager` | Start of `OnIndicatorSetupActivated` |
| `CachedDescriptor`       | Start of `OnIndicatorSetupActivated` |
