ORK 4 RPG Framework Logo
  • ORK 4 GUIDE
    • Documentation
    • Tutorials
    • Extensions
    • API
  • ORK 3 GUIDE
    • Documentation
    • Tutorials
    • API
  • Support
  • Forum
  • Get ORK

ORK 4 Documentation

  • Getting Started
    • Welcome
    • First Steps (Unity)
  • Features
    • The Status System
    • Schematics
    • Schematic Nodes
    • Dialogue Importer
    • Variables
    • Selected Data
  • Components
    • Battle Components
    • Combatant Components
    • Control Components
    • Cursor Prefab Components
    • Game Starters
    • Interactable Components
    • Move AI Components
    • Scene Setup Components
  • Editor
    • The ORK 4 Editor
    • Sections & Sub-Sections
    • Node Editor
    • Schematic Editor
    • Asset Sources
    • Unity Overlay Toolbar
  • Section: System
    • System Settings
    • Languages
    • Organizer Types
    • Game States & Conditions
    • General Condition Templates
    • Object Pools
    • Prefab Savers
    • Scene Connections
  • Section: Controls
    • Game Controls
    • Interaction Settings
    • Player Controls
    • Camera Controls
    • Input Keys
    • Control Maps
    • Camera Positions
    • Battle Camera
  • Section: Gameplay
    • Game Settings
    • Formulas
    • Difficulties
    • Shortcut Slots & Settings
    • Custom Settings & Global Custom Settings
    • Global Machines
    • Machine Templates
  • Section: Status
    • Status Values
    • Status Effects
    • Attack Modifiers
    • Defence Modifiers
    • Abilities & Ability Developments
    • Status Developments
    • Research Trees
    • Damage Types
    • Status Bonuses & Templates
    • Status Condition Templates
  • Section: Inventory
    • Inventory Settings
    • Inventory Containers
    • Currencies
    • Items
    • AI Rulesets
    • Crafting Recipes
    • Equipment Slots & Slot Set Templates
    • Equipment & Available Equipment Templates
    • Shops
    • Loot
  • Section: Combatants
    • Combatants
    • Combatant Groups
    • Class Slots
    • Classes
    • Factions & Faction Benefits
    • Animations
    • Move AIs
    • Formations
    • Action Combos
  • Section: Battles
    • Battle Systems
    • Turn Based Battles
    • Active Time Battles
    • Real Time Battles
    • Phase Battles
    • Battle Spots
    • Battle AIs
    • Battle Actions Settings
    • Special Commands Settings
    • Target Settings
    • Target Selection Templates
    • Battle Range Templates
    • Battle Grid Settings
    • Battle Grid Highlights
    • Battle Grid Cell Types
    • Battle Grid Formations
  • Section: Content
    • Content Types
    • Music
    • Sound Templates
    • Areas
    • Teleports
    • Quests & Quest Tasks
    • Logs & Log Texts
    • Object Contents
  • Section: UI
    • UI Settings
    • UI Layers
    • UI Layouts
    • UI Boxes
    • HUDs
    • Notifications
    • Cursor Settings
  • Section: Menus
    • Start Menu
    • Save Game Settings
    • Option Categories
    • Menu Screens
    • Menu Requirements
    • Battle Menus
    • Loot Dialogues
    • Item Collection
    • Combatant Selections
    • Quantity Selections
    • Shop Layouts
  • Section: Texts
    • Text Settings
    • Formatting Settings
    • Flying Texts
    • Use Cost Display
    • Status Preview Display
    • Bonus Display
    • Status Change Display
    • Console Settings & Console Types
    • Text Codes
  • Sections: Editor
    • Editor Settings
    • Backups
    • Variables
    • Plugins
  • Scripting
    • Access Handler
    • Custom Nodes
    • Custom Save Data
    • Custom Component Save Data

ORK 4 Tutorials

  • ORK 4 Unity Quickstart Tutorials (3D)
    • ORK 4 Unity Quickstart 3D
    • 01 Initial ORK Setup
    • 02 Player Setup
    • 03 Music & Scenes
    • 04 UI System Setup
    • 05 UI Boxes
    • 06 Flying Texts
    • 07 Status Values
    • 08 Status Effects
    • 09 First Abilities
    • 10 Fighter Setup
    • 11 First Enemies & Battle AI
    • 12 Battle System Setup
    • 13 Animating Battle Start and End
    • 14 Random Battles
    • 15 Animating Actions
    • 16 Player Battle HUD
    • 17 Elemental Attacks
    • 18 Animating More Actions
    • 19 Inventory & Loot
    • 20 Equipment
    • 21 Loot, Start Equipment & Viewers
    • 22 Magic Abilities
    • 23 Caster Setup
    • 24 More Enemies
    • 25 Start Menu & Save Games
    • 26 Menu Screens
    • 27 Interactions
    • 28 Item Collectors
    • Quickstart Extended
  • Battle Tutorials
    • Active Time Battles
    • Phase Battles
    • Real TT 01 Real Time Battles & Tab Targeting
    • Real TT 02 Control Map, Use Ranges & Battle Area
    • Real TT 03 Camera Control, Battle AI & Reuse Time
    • Real TT 04 Damage Detection, Action Animation & Player HUD
    • Real TT 05 Switch Player & Final Adjustments
    • Hit & Miss
    • Critical Hits
    • Cast Time
    • Reuse Time
    • Grid 01: Battle Grid Setup
    • Grid 02: Highlights
    • Grid 03: Cell Types
    • Grid 04: Move Command
    • Grid 05: Scene Grid Setup
    • Grid 06: Battle Ready
    • Grid 07 Use & Affect Ranges
    • Grid 08: Better Camera Control
  • Gameplay Tutorials
    • Multiple Interaction Controllers
    • Player Group Spawn & Follow
    • Spawn Hunting Enemies
    • Gamepad Controls (Unity Input System)
    • Combined Inputs
    • Control Map for Keyboard (Shortcuts)
    • Control Map for Gamepad (Shortcuts)
    • Quests 01: Menu Screen
    • Quests 02: Hunting
    • Quests 03: Collect Potion Materials
    • Quests 04: Collect Equipment Materials
    • Quests 05: Quest Mark HUDs
    • Crafting 01: Menu Screen
    • Crafting 02: Materials & Recipes
    • Crafting 03: Getting Materials
    • Crafting 04: Proficiency & Critical Outcome
    • Shop
    • Inventory Containers
  • Schematics Tutorials
    • UI Animation Schematics
    • Flying Text Animation Schematics
    • HUD Conditional Schematics
  • UI Tutorials
    • Unity UI: Initial Setup
    • Unity UI: Status Value UI Setup
    • Unity UI: Status Effect UI Setup
    • Unity UI: Shortcut UI Setup
    • Unity UI: Dragging Notification
    • Unity UI: Interaction HUD
    • Unity UI: Shortcut HUD
    • Unity UI: Turn Order HUD
    • Unity UI: Cast Time HUD
    • Unity UI: Quest HUD
    • Unity UI: Tooltip HUD
    • Unity UI: Move Range HUD
    • Menus 01 UI Box Setup
    • Menus 02 Template HUDs
    • Menus 03 Menu Setup
    • Menus 04 Main Menu
    • Menus 05 Inventory
    • Menus 06 Equipment
    • Menus 07 Ability
    • Menus 08 Group
    • Menus 09 Quest
    • Menus 10 Crafting
  • Module 01: Status System
    • Introduction to Modular Tutorials
    • M01.1: Status Values
      • Introduction to Status Values
      • Health
      • Mana
      • Barrier
      • Base Experience
      • Class Experience
      • Spendable Experience
      • Normal Stats
    • M01.2: Modifiers
      • Introduction to Modifiers
      • Element
      • Attack Type
      • Size
      • Race
    • M01.3: Status Effects
      • Introduction to Status Effects
      • Buffs
      • Debuffs
      • Poison
      • Regeneration
      • Blind
      • Stun
      • Sleep
      • Silence
      • Enchants
      • Charm
      • Doom
      • Reflect
  • Module 02: Actions
    • Introduction to Actions
    • M02.1: Formulas
      • Introduction to Formulas
      • Physical Damage Formula
      • Magical Damage Formula
      • Hit Chance
      • Critical Chance
    • M02.2: Abilities
      • Introduction to Abilities
      • Base Attack
      • Elemental Magic Spells
      • Steal Ability
      • Drain
      • Healing Spell
      • Cure
      • Buff Abilities
      • Debuff Abilities

ORK 4 Extensions

  • Plugins
    • Save Game Compression Plugin
  • Schematic Nodes
    • Footstepper Nodes (Unity)
  • Scripts
    • A* Pathfinding Movement Component (Unity)
    • PolyNav 2D Movement Component (Unity)
    • Cinemachine Camera Control Type (Unity)
    • Rewired Input Key (Unity)
    • Unity Legacy Input Key (Unity)
    • Core GameKit Wrapper (Unity)
    • Pool Boss Wrapper (Unity)
View Categories
  • Guide
  • ORK 4
  • ORK 4 Tutorials
  • UI Tutorials

Unity UI: Dragging Notification

0:00 / 9:03
  • View as Markdown Open this page as plain Markdown (opens in a new tab)
  • Open in ChatGPT Ask questions about this page (opens in a new tab)
  • Open in Claude Ask questions about this page (opens in a new tab)
  • Open in Google AI Studio Ask questions about this page (Google account required) (opens in a new tab)

In this tutorial we’ll set up a dragging notification to show dragged content.

Dragging something from a UI (e.g. a menu screen, battle menu or shortcut HUD) can display the dragged content using a dragging notification. The dragging notification is set up in the UI settings, each UI box can optionally use a custom dragging notification (as well as shortcut slot HUD elements).

In this tutorial we’ll create a UI box for our dragging notification, which will also have some HUD components attached to have more control over the displayed content. You don’t need to use HUD components (or a template HUD) in a dragging notification, as it can also display information in it’s regular message, but using HUDs allows to create more complex UI (though we’ll keep it simple in this tutorial).

This tutorial is based on the ORK 4 Unity Quickstart 3D tutorials, but can be used in any project.

As with all content when using Unity UI, we’ll set up prefabs. It’s best to do this in the UI Environment Scene, so open it.

UI Box Prefab #

The UI box should adjust it’s size to the displayed content, and as said above, we’ll also add HUD components to display information about the displayed content.

Base UI Box #

We’ll start with creating the UI box either using the scene hierarchy’s context menu (ORK Framework > UI Box > UI Box Fit Size) or ORK toolbar (search for: UI Box Fit Size).

Rect Transform #

We’ll change the Rect Transform to have the upper left corner of the box be placed at the cursor position.

For this, we’ll change the pivot of the object.

  • Pivot
    Set to: X=0, Y=1

UI Receive Cursor Events #

This component is automatically added when creating a UI box using the context menu. It handles detecting if the UI box was clicked or if the cursor is over it.

Since our dragging notification will follow the cursor, it’s best to remove it to not interfere with the other UI boxes.

Remove the component.

Content Size Fitter #

The default setup for this UI box will only adjust the vertical size (height) to the displayed content. Let’s change it to also adjust the horizontal size (width).

  • Horizontal Fit
    Select: Preferred Size

HUD Content Provider #

Next, we’ll add start with the HUD component setup of the UI box.

HUD components need a content provider that handles the content they display. In regular HUDs, their root HUD component is usually their content provider.

When UI boxes directly display HUD components (e.g. instead of using a HUD template), they need to add a content provider component to be able to display content in HUD components.

Add a HUD Content Provider component to the UI Box object to handle this for us.

  • Provider Type
    Select: None
    This is the default setup of a new content provider – it’s used when the content provider will receive it’s content from somewhere else.
    In our case, the content will come from the UI Content component distributing the UI box’s content.

UI Content #

In order to get the displayed content to the content provider we added, we need to select it in the UI box’s UI Content component (which handles displaying the UI box’s main content).

  • HUD Content Provider
    Select the HUD Content Provider component we just added.
    E.g. by dragging it on the field (or selecting the UI Box object).
  • Text Disable If Empty
    Enable
    This’ll disable the object that displays the regular content text (the Text child object of the UI box in this setup) in case no text is displayed. This’ll prevent an empty text from having an impact on the layout.

Add Icon #

Now, we’ll add actual HUD content to the UI box.

The UI box is set up to list content vertically – we’ll add an icon as our first HUD content.

Just like creating HUDs, either use the scene hierarchy context menu (ORK Framework > HUD > Content > HUD: Icon Content) or ORK toolbar (search for: HUD Icon Content).

HUD Text Content #

Icons are also displayed using HUD Text Content components, but this setup doesn’t add a component for displaying the text, only an Image for the icon.

The default setupof the component that was created is already what we need, using the General content type that can show content information of any content. The setup shows no text, only the icon of the content.

UI Content #

We want to disable the icon’s object in case some displayed content doesn’t have any icon.

The icon is displayed with a sprite, so we need to disable it if no sprite is available.

  • Sprite Disable If Empty
    Enable

Layout Element #

Additionally, we want to display the icon with a fixed size of 100×100.

Add a Layout Element to the Icon Content object.

  • Preferred Width
    Enable
    Set the width to: 100
  • Preferred Height
    Enable
    Set the width to: 100

Add Text #

And as the last content added to the UI Box object, we’ll add a HUD text content to display the name of the dragged content.

Again, either use the scene hierarchy context menu (ORK Framework > HUD > Content > HUD: Text Content) or ORK toolbar (search for: HUD Text Content).

HUD Text Content #

We want to display the name of the content, i.e. we’ll use the text code <name>.

  • Default Content
    Set to: <name>

UI Content #

Same as the icon, we want to disable the text in case something doesn’t have a name.

  • Text Disable If Empty
    Enable

TextMeshPro – Text (UI) #

This component handles displaying the actual text.

In case you want to change the font, size, color, etc. – this is where you can do it.

Create Prefab #

And that’s it for the UI box prefab – the finished UI box will look something like this:

Create a prefab out of the UI Box object and name it UI Box Drag.

You can now remove the object from the scene.

UI Box Setup #

With our prefab created, we can now set up the UI box that’s used by the dragging notification (and uses the UI box prefab).

Open the ORK editor, navigate to UI > UI Boxes and add a new UI box.

Base Settings #

  • Name
    Set to: Drag
  • UI Layer
    Select: HUD
    It’s best to have the drag box shown above your other UI boxes used by menus.
    This makes sure the drag is always displayed on top of the menus.
  • Cursor Over
    Disable
    We don’t want the UI box to recognized by cursor over checks to prevent it from blocking the drag+drop operation.

Position Settings #

We want the drag notification to follow the cursor and also stay within the screen bounds.

  • Limit to Screen
    Enable
  • At Cursor
    Enable
  • Follow Cursor
    Enable

Unity UI #

  • UI Box Prefab
    Select: UI Box Drag

Drag and Drop Setup #

Navigate to UI > UI Settings.

Drag/Drop Settings #

These settings handle dragging and dropping content.

The Raycast Settings are used when something is dropped into the world, e.g. dragging an item on a combatant uses a raycast to find what it was dropped on. Make sure the Layer Mask is set up correctly for your layer setup.

We’ll set up some basic settings first.

  • Layers
    Select only the Default layer.
  • Drag Set Selection
    Enable
    This’ll set an input (e.g. button) as the selected input when starting a drag from it.
  • Drop Set Selection
    Enable
    This’ll set an input (e.g. button) as the selected input when dropping a drag on it.
  • Block Tooltips
    Enable
    Tooltips will be blocked while dragging something.

Dragging Notification #

Finally, we set up the dragging notification.

  • Show Drag
    Enable
  • Drag Box
    Select: Drag

Message Content #

  • Add HUD
    Enable
    This’ll add HUD content information to the displayed content and allows the HUD Content Provider we added to the UI box to use it.
  • HUD
    Select: None HUD (default selection)
    Not selecting a HUD here will still add the HUD content for the content provider, but not use a HUD as template.
    If you select a HUD, the HUD’s prefab will be used to create an instance of the HUD as a child object of the UI box.
  • Text
    Set it to an empty text, since we handle displaying the content using the HUD components.

Save Changes #

And that’s it – click on Save Settings to save the changes.

Testing #

To test the dragging notification, you need to enable dragging in one of your menus – e.g. a menu screen (Menus > Menu Screens).

Menu screen parts that support drag/drop will have their separate Drag and Drop settings, e.g. the Inventory menu part.

Tip: Using HUD Templates #

Instead of adding the HUD components directly to the UI box as described in this tutorial, you can also use an existing HUD as a template. Tooltip type HUDs are probably the best fit, but you can use any HUD you want.

Using a HUD template is a good idea if you’ve already set up a HUD that looks like you want your drag notifications to look, or want to reuse the drag look in other parts of the UI.

To use a HUD template, simply select a HUD in the dragging notification’s settings instead of using the None HUD. And don’t add HUD components to the UI box, or they’ll both be used.

Table of Contents
  • UI Box Prefab
    • Base UI Box
      • Rect Transform
      • UI Receive Cursor Events
      • Content Size Fitter
    • HUD Content Provider
      • UI Content
    • Add Icon
      • HUD Text Content
      • UI Content
      • Layout Element
    • Add Text
      • HUD Text Content
      • UI Content
      • TextMeshPro - Text (UI)
    • Create Prefab
  • UI Box Setup
    • Base Settings
      • Position Settings
    • Unity UI
  • Drag and Drop Setup
    • Drag/Drop Settings
    • Dragging Notification
      • Message Content
  • Save Changes
  • Testing
  • Tip: Using HUD Templates
Sitemap
  • Showcase
  • ORK 4 Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • ORK 3 Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK
  • Contact
  • Blog
  • Makinom
  • gamingislove.com
Categories
  • News (75)
  • ORK 2 (137)
    • Tutorial (137)
      • Game tutorial (50)
      • Gameplay (32)
      • How-to (55)
  • Release (158)
Search

© 2015 Gaming is Love e.U.

Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!