Visual_Names_Instructions.md 2.6 KB

How to Use the Visual Map Names System

Quick Setup

  1. Make sure you have the MapSceneSetup script attached to any GameObject in your scene
  2. Play the scene - it will automatically set up all components
  3. Names will appear on the map by default as white text labels
  4. Press N key to toggle names on/off
  5. Hover over locations to see tooltips and highlighting

What You'll See

Visual Names on Map

  • Towns: Large names at the center of 3x3 town areas
  • Villages: Names above single village tiles
  • Forests: Names at the center of connected forest regions
  • Lakes/Waters: Names at the center of water bodies

Interactive Features

  • Hover tooltips: Move mouse over named areas to see tooltips
  • Region highlighting: Primary (yellow) on hovered tile, secondary (light yellow) on connected tiles
  • Toggle display: Press N key to show/hide all names
  • Road naming removed: Roads no longer get names (as requested)

Controls

  • WASD: Move camera around map
  • Mouse Scroll: Zoom in/out
  • Mouse Hover: Show tooltips and highlighting
  • N Key: Toggle permanent name display on/off

Customization

In MapNameDisplay Component Inspector:

  • Text Font: Assign a custom font (optional)
  • Font Size: Adjust text size (default: 14)
  • Text Color: Change text color (default: white)
  • Text Outline Color: Change outline color (default: black)
  • Text Height: How high above tiles the text appears
  • Show Names On Start: Whether names show immediately when scene loads
  • Toggle Display Key: Which key toggles names (default: N)

Debugging

  • Set Debug Mode to true in both TileHoverHandler and MapNameDisplay
  • Check console for name generation and display messages

Troubleshooting

No Names Visible

  1. Make sure MapSceneSetup script is on a GameObject in the scene
  2. Check that MapNameDisplay component was created (look in hierarchy)
  3. Try pressing N key to toggle names
  4. Check console for error messages

Names Don't Update After Map Regeneration

  • Use the "Regenerate Map" context menu on MapSceneSetup component
  • Or manually call nameDisplay.RefreshLabels() in code

Names Not Facing Camera

  • Make sure camera is tagged as "MainCamera"
  • Check that MapNameDisplay found the camera (debug messages)

Technical Notes

  • Names are generated once when the map creates
  • Text uses Unity's TextMesh component for 3D world-space rendering
  • Reflection is used to access name data from TileHoverHandler
  • Labels automatically face the camera and include black outlines for readability