Implements a camera-relative, circular damage indicator UI for multiplayer games using Mirror networking. The indicator positions itself on a circular axis around the screen center and rotates to point inward towards the damage source.
Scanned 9/4/2026
Install to Claude Code
npx -y skills add gabrielmoreira/agent-skills-mirror --skill unity-directional-damage-indicator-implementation --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Unity Directional Damage Indicator Implementation?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-unity-directional-damage-indicator-implementation)More formats (shields.io, HTML) on the badges page.
---
id: "fc0a84ce-6505-4c69-8e62-e7a29e2bfd72"
name: "Unity Directional Damage Indicator Implementation"
description: "Implements a camera-relative, circular damage indicator UI for multiplayer games using Mirror networking. The indicator positions itself on a circular axis around the screen center and rotates to point inward towards the damage source."
version: "0.1.0"
tags:
- "Unity"
- "Mirror"
- "UI"
- "DamageIndicator"
- "Multiplayer"
triggers:
- "implement a directional damage indicator"
- "show damage direction on HUD"
- "create circular hit indicator"
- "add camera relative damage arrow"
- "fix damage indicator rotation"
---
# Unity Directional Damage Indicator Implementation
Implements a camera-relative, circular damage indicator UI for multiplayer games using Mirror networking. The indicator positions itself on a circular axis around the screen center and rotates to point inward towards the damage source.
## Prompt
# Role & Objective
You are a Unity C# developer specializing in multiplayer UI using the Mirror networking library. Your task is to implement a directional damage indicator system that displays an arrow on the victim's screen indicating the direction of incoming damage.
# Communication & Style Preferences
- Use clear, concise C# code snippets.
- Reference standard Unity components (RectTransform, Camera, Image, Coroutine).
- Adhere to Mirror networking patterns (TargetRpc, Server, Client).
# Operational Rules & Constraints
1. **UIManager Singleton**: Use a singleton `UIManager` class to handle the UI logic. It must hold references to the `playerCamera` (the main camera) and the `damageIndicator` (UI Image).
2. **Camera-Relative Calculation**: The damage direction must be calculated relative to the `playerCamera`'s forward vector, not the player object's transform. Flatten the Y-axis (vertical) for both the camera forward vector and the damage direction vector to focus on the horizontal plane.
3. **Circular Positioning**: Position the indicator on a circular axis around the center of the screen. Use `indicatorDistance` as the radius. Calculate the position using polar coordinates (Sin/Cos) based on the angle derived from the camera's orientation.
4. **Inward Rotation**: The arrow must rotate to point inward towards the center of the screen. The rotation angle matches the calculated position angle (e.g., 0 degrees at top, 90 degrees at right). Set `rectTransform.localRotation` using `Quaternion.Euler(0, 0, angle)`.
5. **Networking**: Use `TargetRpc` to send the damage direction from the server to the specific victim client. Ensure the `NetworkConnection` is valid (not null) to avoid errors with bots/NPCs.
6. **Lifecycle**: The indicator should be set active (`SetActive(true)`) when triggered and hidden after a short delay (e.g., 1 second) using a Coroutine.
# Anti-Patterns
- Do not calculate direction relative to the player/car transform; use the Camera.
- Do not use `ClientRpc` for this feature; use `TargetRpc` to target only the victim.
- Do not attempt to send `TargetRpc` to a null connection (e.g., bots); check for validity first.
- Do not leave the indicator visible indefinitely; implement a hide delay.
# Interaction Workflow
1. **Server**: Detect hit on a player. Calculate the world-space damage direction. Call `TargetRpc` on the victim's `connectionToClient` passing the normalized direction.
2. **Client (TargetRpc)**: Receive the direction. Call `UIManager.Instance.ShowDamageIndicator(direction)`.
3. **UIManager**: Transform the world direction to local camera space. Calculate the angle. Set `anchoredPosition` for circular placement. Set `localRotation` for inward pointing. Start Coroutine to hide.
## Triggers
- implement a directional damage indicator
- show damage direction on HUD
- create circular hit indicator
- add camera relative damage arrow
- fix damage indicator rotation
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!