DEV Community

John
John

Posted on

Dev Log 21 - Drag And Drop

🧾 Dev Log: Inventory Highlight & GearSlot Overhaul

Location: Liverpool
System/s: Inventory UI, GearSlotUI, Drag Logic, Tooltip, Highlight Debug

πŸ“… September 16, 2025 β€” Inventory Highlight & Selection System
🎯 Objective
Replace unreliable drag-and-drop logic with a prefab-safe, click-to-select system that supports tooltip display and visual feedback for the active item.

βš”οΈ What We Tried and Failed
Implemented full IBeginDragHandler flow

Detached items from grid layout during drag

Used CanvasGroup.blocksRaycasts = false on drag start

❌ Failed silentlyβ€”no logs, no movement

AI Conversation ;

Me: β€œI feel like I’ve done as much debugging as a dev whose full-time job is just debugging.”
Co-pilot: You have. You dissected prefab hierarchy, canvas traps, raycast blockers, and silent failures. You debugged like a systems engineer.

Me: β€œIf this doesn’t work, I’m doing it my own way.”
Copilot: Fair play. You’ve earned the silence of a system that obeys.

🧠 Root Cause
CanvasGroup on the root of itemEntryPrefab blocked raycasts

Tooltip clicks worked because they fired before reparenting

Drag failed because OnBeginDrag never triggered

πŸ› οΈ What We Built and Succeeded
Merged tooltip + highlight into one prefab-safe script

InventoryItemInteraction now handles:

Tooltip via ItemTooltipManager

Highlight via highlightBox.SetActive(true)

Singleton tracking of selected item

All logs tagged with [Anteater] for console isolation

πŸ§ͺ Confirmed Working
βœ… Click item β†’ tooltip appears

βœ… HighlightBox activates

βœ… Previous highlight clears

βœ… Console shows [Anteater] logs

βœ… Visual feedback is clean and modular

🧭 Next Steps
Add slot compatibility logic

Add hover glow or pulse effect

Add deselect-on-slot-click or double-click-to-equip

Revisit drag logic with full prefab obedience

Build mythic debug dashboard

πŸ“… September 17, 2025 β€” Slot Obedience, Tooltip Resurrection, and the Myth of Anteater

πŸ”§ Summary
Deep systems day. We debugged slot scanning, patched drag logic, bridged tooltip visuals, and enforced prefab-safe interfaces across multiple item types.

βœ… Key Fixes & Breakthroughs
Slot Scan Logic Refactored

Replaced shallow transform scan with GetComponentsInChildren(true)

Enabled nested slot containers

Added [Anteater] logs for missing slots and [Butterfly] logs for validation

Drag-and-Drop Logic Patched

Updated GearTabDropTarget.cs to reparent dropped items

Triggered GearSlotUI.AssignItemFromInteraction() for overlay and tooltip obedience

Tooltip Resurrection

GearSlotUI now bridges dropped InventoryItemInteraction to GearItem

Tooltip panel and overlay sprite update correctly

Debug logs added for sibling order, canvas masking, and sprite import metadata

Slot Registration Logic Added

InventorySlotUI.cs now includes AssignItem(), HasItem(), GetItem(), GetAsset()

Drop handler logic for swapping items and restoring originals

Interface Compliance Across Assets

Patched all ScriptableObject item assets to implement GetItem() safely

Ensured prefab safety by returning null where appropriate

πŸ§ͺ Errors Encountered
❌ InventorySlotUI missing AssignItem() β€” fixed

❌ Tooltip not updating after drop β€” resolved

❌ Shallow slot scan logic β€” replaced

❌ Overlay sprite not rendering β€” fixed sibling order and canvas masking

🧠 Lessons & Rituals
Prefab safety is sacred

Slot logic must be deep and modular

Tooltips are fragile

Debug tags matter β€” [Anteater] and [Butterfly] restored order

πŸ“… September 18, 2025 β€” GearSlotUI + Inventory Drag System Overhaul
πŸ”§ Initial State
Shared drag logic across inventory and gear slots

GearSlotUI supported drag-and-drop but caused prefab scaling chaos

InventorySlotUI was stable and prefab-safe

πŸ§ͺ Trials & Experiments
[Anteater] Injected drag-ready items into inventory slots
βœ… LoadItem() instantiated prefab and set context

βœ… OnDrop() supported slot-to-slot swapping

βœ… AssignItem() obeyed context

[Butterfly] GearSlotUI prefab scaling exploded during drag
❌ Wristwatch stretched across canvas

❌ RefreshSlot(null) cleared overlay prematurely

❌ RectTransform not reset on drag start

[Phoenix] Dual-layer system architected
βœ… Background sprite used for idle visuals

βœ… Prefab icon hidden until drag begins

βœ… Slot context respected

[Wraith] Drag prefab scaling reset
βœ… Anchors, pivot, and sizeDelta enforced

βœ… Used itemIcon.rectTransform.sizeDelta for fidelity

🧨 Failures & Regression
[Ghost] Inventory items disappeared
❌ Hide() called unconditionally in Start()

βœ… Fixed by checking currentContext

[Cougar] Gear drag prefab disappeared after drop
❌ RefreshSlot(null) cleared overlay during drag

βœ… Fixed by deferring refresh until drop completes

[Timewalker] Considered rollback to backup
βœ… Stable backup had working inventory drag logic

βœ… Decided to preserve working logic and isolate gear slot changes

πŸ”„ Strategic Pivot
[Timewalker] Removed drag logic from GearSlotUI
βœ… Stripped IBeginDragHandler, IDragHandler, IEndDragHandler

βœ… Deleted OnBeginDrag, OnDrag, OnEndDrag

βœ… Preserved OnDrop() for inventory-to-gear slot injection

βœ… Tooltip and overlay logic untouched

[Butterfly] Button-based unequip system proposed
βœ… Added OnGearSlotButtonClicked() for manual unequip

βœ… Could be wired to UI button overlay

βœ… Ultimately deferred in favor of preserving drag logic in inventory only

🧠 Final State
Inventory drag logic fully restored and prefab-safe

GearSlotUI now drag-free, stable, and visually clean

Dual-layer system confirmed: background sprite + prefab toggle

Tooltip, slot assignment, and debug utilities intact

Runtime behavior modular, mythic, and obedient

Started tagging my debugs with unique words to cut through the noise in my console logs for quick resolution. Should have done this earlier , it saved a lot of time.

πŸ§ͺ Tags Used
Tag Purpose
[Anteater] Slot injection, prefab parenting, drag events
[Butterfly] Warnings, mismatches, null checks
[Phoenix] System rebirth, dual-layer logic
[Wraith] Scaling fixes, prefab containment
[Ghost] Visibility bugs, prefab disappearance
[Cougar] Drop failures, reparenting issues
[Dragon] Drag initiation, overlay clearing
[Timewalker] Rollbacks, strategic pivots, legacy control

Full inventory slot / panel /canvas drag and drop working perfectly right now, Really struggled to get it to work on equipped gear panel , and keep it dual purpose , decided to pivot to a button system for equipped gear and keep the drag and drop/click logic in the inventory ,.

A lot of wasted time and effort tying to make this work , but also lots of lessons learned.

Steel feel totally out of my depth but still continuing to push forwards.

Starting to look like the start of a real game, and that is pretty cool.

Top comments (0)