Legendary Tools - Common
com.legustavinho.legendary-tools-common 
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/legendary-tools-common.git README Markdown
Copy this to your project's README.md
## Installation
Add **Legendary Tools - Common** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/legendary-tools-common.git
```
[](https://www.pkglnk.dev/pkg/legendary-tools-common)Dependencies (5)
README
๐ Legendary Tools Library Overview
This library provides a collection of utilities, data structures, patterns, and editor tools for Unity development. Below is a categorized breakdown of key classes/interfaces, with descriptions of their utility. ๐
๐ Concurrency and Asynchronous Utilities
AsyncWait ๐:
Provides asynchronous waiting methods (e.g., ForSeconds, ForFrames, Until, While) with support for multiple backends like Unity Coroutines, UniTask, or native Tasks. Useful for non-blocking delays or condition-based waiting in games, reducing coroutine clutter and improving performance in async-heavy code.ThreadedRoutine ๐งต:
Manages routines that can run on background threads, with integration for Unity's main thread synchronization. Ideal for offloading CPU-intensive tasks (e.g., computations) without freezing the game loop, while ensuring safe Unity API calls.
๐ Data Structures and Algorithms
AStar ๐บ๏ธ:
Implements the A* pathfinding algorithm for grid-based or graph-based navigation. Useful for AI pathfinding in games (e.g., finding shortest paths in maps), with customizable heuristics for efficiency.Bictionary ๐:
A bidirectional dictionary (two-way mapping between keys and values). Handy for scenarios like entity-ID lookups or reversible mappings, saving time on manual inversion.CircularBuffer ๐:
A fixed-size buffer that overwrites old data in a circular fashion. Great for logging, history tracking, or fixed-window data (e.g., recent player inputs) without resizing overhead.Tree ๐ณ:
A generic tree structure for hierarchical data. Useful for scene hierarchies, decision trees, or organizational structures in games.SelfBalanceTree โ๏ธ:
An AVL-like self-balancing binary search tree. Ensures O(log n) operations for sorted data, ideal for dynamic datasets like leaderboards or sorted inventories.MultiParentTree ๐ฟ:
A tree allowing nodes with multiple parents (Directed Acyclic Graph-like). Useful for complex relationships, such as skill trees with shared prerequisites.Graph ๐:
A generic graph structure with nodes and connections, supporting directed/undirected edges. Core for modeling networks, state machines, or procedural generation (e.g., dungeon layouts).BinaryTree ๐ฟ:
A basic binary tree for ordered data. Suitable for binary search or simple hierarchical storage, like expression trees.Hex ๐ท:
Utilities for hexagonal grid systems (e.g., coordinates, neighbors). Essential for hex-based games like strategy titles, handling movement and adjacency efficiently.Inventory ๐:
A generic inventory system for managing items with stacks, slots, and events. Useful for RPGs or crafting systems to handle item addition/removal without boilerplate.ScriptableObjectInventory ๐:
An inventory backed by ScriptableObjects for data-driven design. Integrates with Unity's asset system for easy editing and persistence of inventories.ManyToManyMap ๐:
Maps multiple keys to multiple values (e.g., tags to objects). Perfect for tagging systems or relational data without databases.MappedList ๐:
A list with fast lookup via a dictionary map. Combines list ordering with O(1) access, useful for indexed collections like UI elements.MovingAverage ๐:
Computes rolling averages over a window of values. Handy for smoothing data like FPS counters or sensor inputs.NestedType ๐ช:
Represents a type with nested subtypes. Useful for reflection-heavy code, like dynamic UI generation from complex types.NestedTypes ๐ช:
Collection of nested types for a parent type. Aids in editor tools or runtime type discovery for modular systems.Observable ๐:
Implements the observer pattern for event-driven updates. Useful for decoupling components (e.g., notifying UI of data changes).Octree ๐:
3D spatial partitioning for efficient queries (e.g., collision detection). Optimizes performance in large 3D scenes by reducing checks.OneToManyMap ๐:
Maps one key to multiple values. Ideal for grouping (e.g., players by team) with fast lookups.OneToOneMap ๐:
Strict one-to-one mapping enforcing uniqueness. Useful for pairings like input-action bindings.PriorityQueue โฐ:
A heap-based queue for priority-ordered elements. Essential for task scheduling or AI decision-making.QuadTree ๐ฉ:
2D spatial partitioning for queries (e.g., visibility culling). Improves efficiency in 2D games with many objects.SerializableType ๐ฆ:
Serializes System.Type for Unity storage. Allows saving type references in ScriptableObjects or scenes.SerializedDateTime โฑ๏ธ:
Serializable wrapper for DateTime. Useful for saving timestamps in player data or logs.SerializedTimeSpan โณ:
Serializable wrapper for TimeSpan. Handy for durations in configs or save files.
๐ก๏ธ Design Patterns and Core Utilities
Pool โป๏ธ:
Object pooling system for reusing instances (e.g., bullets, enemies). Reduces garbage collection and instantiation overhead in performance-critical games.ServiceLocator ๐:
Global access point for services (e.g., audio manager). Simplifies dependency injection without full DI frameworks.Singleton ๐:
Ensures a single instance of a class (e.g., game manager). Classic pattern for global state, with Unity-specific handling for persistence.HardStateMachine โ๏ธ:
A rigid, enum-based state machine for finite states (e.g., player states like idle/jump). Simple and efficient for basic FSM needs.AdvancedStateMachine โ๏ธ:
Hierarchical state machine with sub-states and transitions. Useful for complex AI or UI flows with nested behaviors.Persistence ๐พ:
Handles saving/loading data (e.g., player prefs, files). Abstracts storage for cross-platform persistence.SOVariable ๐:
ScriptableObject-based variables for decoupled data (e.g., health). Enables runtime changes and event-driven updates.SOEvent ๐:
ScriptableObject events for broadcasting without direct references. Promotes loose coupling in event systems.ScriptableObjectVariant ๐:
Variants of ScriptableObjects with overrides. Useful for inheritance-like customization without subclassing.Tag ๐ท๏ธ:
Custom tagging system beyond Unity's built-in tags. Allows multi-tagging for flexible querying.
๐ฎ Unity-Specific Utilities
DictionaryConfigEnumWeaver ๐:
Generates enums from ScriptableObject configs and weaves dictionaries. Automates mapping for data-driven enums (e.g., items).DictionaryConfigNamesWeaver ๐:
Weaves string constants from config names. Ensures compile-time safety for referencing configs.DebugFilterConfig ๐:
Configures debug logging levels per type. Filters logs to reduce noise in large projects.Debugger ๐:
Custom logging with filtering and formatting. Enhances Unity's Debug with type-based control.FollowTransform ๐ฃ:
Smoothly follows a target's position/rotation. Useful for cameras or UI elements tracking objects.ProximityDetector ๐ก:
Detects overlapping actors via triggers/colliders. Base for proximity-based interactions (e.g., NPC detection).VisibilityDetector ๐๏ธ:
Checks if objects are visible in the viewport. Optimizes rendering or logic for on-screen elements.UniqueBehaviour ๐:
Ensures unique MonoBehaviours in scenes (e.g., singletons). Validates duplicates in editor/playmode.UniqueScriptableObject ๐:
Ensures unique ScriptableObjects across assets. Prevents ID conflicts in data-driven systems.UnityHub ๐:
Central hub for Unity events (Update, FixedUpdate). Simplifies global event subscription.ColorUtil ๐จ:
Color manipulation helpers (e.g., lerp, conversions). Useful for procedural colors or UI themes.CurveUtil ๐:
AnimationCurve utilities (e.g., evaluation, editing). Aids in tweening or procedural animations.FlagUtil ๐ฉ:
Bitwise flag operations for enums. Simplifies managing flag-based states (e.g., permissions).HSV ๐จ:
HSV color model helpers. Easier for color adjustments than RGB (e.g., hue shifts).MathUtil โ:
Extended math functions (e.g., clamping, remapping). Fills gaps in Unity's Mathf for common ops.MeshUtil ๐ธ๏ธ:
Mesh generation/manipulation tools. Useful for procedural meshes (e.g., dynamic terrain).Security ๐:
Basic encryption/decryption for data. Protects save files or assets from tampering.
๐ ๏ธ Editor Tools and Windows
AssetGuidMapper ๐๏ธ:
Maps and tracks GUIDs in project files. Helps with asset refactoring or merge conflicts.AssetNavigatorWindow ๐งญ:
Editor window for browsing/searching assets. Speeds up asset management in large projects.AssetUsageFinder ๐:
Finds usages of assets in scenes/prefabs. Essential for cleanup or dependency analysis.CommandGenerator โก:
Generates command classes/patterns. Automates undoable actions or input handling.CopySerializedValuesWindow ๐:
Copies serialized data between objects. Useful for duplicating component setups.MonoBehaviourToScriptableObjectConverter ๐:
Converts MonoBehaviours to ScriptableObjects. Migrates behavior to data-driven assets.UIComponentFieldGenerator ๐ผ๏ธ:
Auto-generates fields for UI components. Saves time in UI scripting.ScriptInSceneAnalyzer ๐:
Analyzes scripts used in scenes. Helps identify unused code or dependencies.DefineSymbolsEditor โ๏ธ:
Manages scripting define symbols. Toggles features/platforms in editor.GUIStyleBrowser ๐จ:
Browses and previews GUIStyles. Aids in custom editor UI design.NestedTypesEditor ๐ช:
Editor for handling nested types. Simplifies inspection of complex data.VisualGraphEditorWindow ๐:
Visual editor for graphs (nodes/edges). Useful for designing state machines or dialogs.PlayerPrefsEditor ๐พ:
Editor for viewing/editing PlayerPrefs. Debugs persistent data easily.PlayModeStarterFromScene0 โถ๏ธ:
Starts playmode from scene 0. Automates testing workflows.InlineEditorDrawer ๐ผ๏ธ:
Draws inline editors for properties. Enhances inspector usability.MinMaxSliderDrawer ๐:
Custom drawer for min-max sliders. Improves range editing in inspectors.MultiLevelEnumDrawer ๐:
Drawer for nested/multi-level enums. Handles complex enum hierarchies.SerializableDictionaryDrawer ๐:
Inspector drawer for serializable dictionaries. Makes dicts editable in Unity.SerializableTypeDrawer ๐ฆ:
Drawer for SerializableType. Visualizes type references.SerializedDateTimeDrawer โฑ๏ธ:
Drawer for SerializedDateTime. User-friendly date editing.SerializedTimeSpanDrawer โณ:
Drawer for SerializedTimeSpan. Edits durations intuitively.UniqueBehaviourReferenceDrawer ๐:
Drawer for referencing UniqueBehaviours. Ensures unique selections.MultiScriptableObjectEditor ๐:
Edits multiple ScriptableObjects at once. Batch editing for configs.ScriptableObjectBrowser ๐:
Browses ScriptableObjects in editor. Quick access to assets.SpreadsheetImporterWindow ๐:
Imports data from spreadsheets (e.g., CSV/Excel). Data-driven content population.RenderingPerformanceHubWindow ๐:
Monitors rendering performance. Profiles draw calls, batches, etc.StatePersisterEditor ๐พ:
Persists state machine data in editor. Saves/loads FSM configurations.FieldSyncEditor ๐:
Syncs fields between objects in editor. Automates data alignment.SceneUiObjectsTagger ๐ท๏ธ:
Tags UI objects in scenes. Organizes canvas elements for querying.
๐ญ Actor System
Actor ๐ญ:
Base for actor-model entities (message-passing concurrency). Decouples systems for scalable, thread-safe logic.ActorMonoBehaviour ๐ญ:
MonoBehaviour wrapper for Actors. Integrates actor pattern with Unity's component system.
โ๏ธ Attribute System
AttributeConfig โ๏ธ:
Config for attributes (e.g., health, speed). Data-driven entity stats.Attribute โ๏ธ:
Runtime attribute with modifiers. Handles buffs/debuffs for RPG entities.Entity ๐งโ๐คโ๐ง:
Base entity with attributes. Core for character/NPC systems.
๐ต Bragi Audio System
Bragi ๐: High-level audio hub with pooling that spawns AudioHandlers and plays AudioConfig or AudioGroup at a position/parent, including simultaneous, sequential, or chained modes.
AudioHandler ๐: Component that owns an AudioSource, applies AudioSettings, exposes IsPlaying/IsPaused/IsMuted, fade in/out, events (OnPlay, OnFinished, OnStop), and returns itself to the pool on dispose.
Jukebox (+ JukeboxConfig) ๐ถ: Playlist player with sequential/random/random-reseeding and loop/circular options; commands (Next/Prev/Mute/Unmute/Pause/Stop) and automatic continuation when a handler finishes.
UIAudioTrigger ๐: Drop-in component to bind UI/Unity events (pointer, select, drag, lifecycle, or custom string) to AudioConfig plays, with an option to prevent parallel plays.
๐ง Miscellaneous Systems
- Chronos โณ:
Time management system (e.g., timers, scheduling). Useful for cooldowns or timed events.
๐ผ Maestro System (Initialization and Task Management)
GameInitialization ๐:
Manages game startup with sequenced init steps. Ensures orderly loading (e.g., assets before UI).InitStepConfig โ๏ธ:
Configurable init task with dependencies/timeouts. Modularizes startup logic.Maestro ๐ผ:
Orchestrates tasks with dependencies, timeouts, and internet checks. Handles async initialization graphs.
๐ฅ๏ธ Screen Flow System (UI Navigation)
ScreenConfig ๐ผ๏ธ:
Config for screens/popups with transitions. Defines navigation rules.ScreenFlow ๐:
Manages screen transitions, history, and popups. Simplifies app-like navigation in Unity.
๐ผ๏ธ UI Components
CircularScrollView ๐:
Infinite circular scrolling UI. Ideal for carousels or looping lists.DynamicScrollView ๐:
Scroll view with dynamic item population. Optimizes large lists (e.g., inventories).FieldSync ๐:
Syncs fields between components/objects. Automates data binding.GameObjectListing ๐:
Lists GameObjects (e.g., in UI). Useful for dynamic menus or debug panels.ProximityUiBehaviour ๐ก:
Displays UI based on proximity (e.g., interaction prompts). Enhances immersive interactions.UIFollowTransform ๐ฃ:
UI element follows a 3D transform. For world-space UI like health bars.UIGradient ๐:
Applies gradients to UI elements. Enhances visual appeal without shaders.UILineConnector ๐:
Draws lines between UI points. Useful for graphs or connections in menus.UISafeArea ๐ฑ:
Adjusts UI for device safe areas (e.g., notches). Ensures compatibility on mobile.
No comments yet. Be the first!