Agent Personalization System Setup
A complete personalization system for agents with randomized names, stats, and clickable info panels.
Files Created
Scripts
- AgentNameGenerator.cs - Generates random names (mix of silly, real, and fantasy)
- AgentStats.cs - Agent stats system (Strength, Speed, Magic, Dexterity)
- AgentInfoPanel.cs - UI controller for agent info popup
- AIAgent.cs (modified) - Added name, stats, and click detection
UI
- AgentInfoPanel.uxml - Info panel layout
- AgentInfoPanel.uss - Info panel styling
Setup Instructions
Step 1: Ensure Agents Have Colliders
Agents need a collider for click detection. Verify in AIAgentManager.CreateDefaultAgentPrefab() that agents have:
- ✓ SphereCollider (or BoxCollider/CapsuleCollider)
- ✓ Mesh renderer for visibility
Step 2: Create Agent Info Panel
- Create a new GameObject called "AgentInfoPanel"
- Add UIDocument component
- Set Panel Asset to
AgentInfoPanel.uxml
- Add AgentInfoPanel.cs script to the same GameObject
- The script will auto-find and setup everything
Step 3: (Optional) Create Main UIDocument
If you don't already have one:
- Create GameObject "MainUI"
- Add UIDocument component
- Assign AgentStatsPanel.uxml as Panel Asset
- Add AgentStatsUIController script
Features
Agent Names
- Randomly generated on spawn
- Mix of silly names (Bobo, Zippy), real names (Alex, Sam), and fantasy names (Aragorn, Merlin)
- Format: "FirstName LastName"
- Visible in hierarchy as: "Agent_0 (Bobo McWiggle)"
Agent Stats
- Strength: Physical power
- Speed: Movement speed
- Magic: Magical ability
- Dexterity: Agility and precision
- Each stat: 1-100
- Total pool: 40 points (so stats are relatively balanced)
- Generated randomly on spawn with normalization
Clickable Agents
- Click any agent in the maze
- Shows info panel with:
- Agent name
- All stats with progress bars
- Total stats
- Current status (Exploring or Reached Exit)
- Click close button or outside panel to dismiss
- Panel appears on right side of screen
How It Works
Name Generation
string name = AgentNameGenerator.GenerateRandomName();
// Result: "Legolas Windrunner", "Bobo Fizzlebop", "Jordan Darkbringer", etc.
Stats Creation
AgentStats stats = new AgentStats();
Debug.Log(stats); // STR: 8 | SPD: 12 | MAG: 10 | DEX: 10 | Total: 40
Click Detection
- AIAgent has
OnMouseDown() which calls AgentInfoPanel.ShowAgentInfo()
- Requires collider on agent GameObject
- Works with raycasting automatically
Customization
Add More Names
Edit AgentNameGenerator.cs:
private static readonly string[] FirstNames = new[]
{
// Add your names here
"CustomName",
// ...
};
Change Stats Pool
Edit AgentStats.cs:
private const int STAT_TOTAL_POOL = 40; // Change this value
Change Info Panel Position
Edit AgentInfoPanel.uss:
.info-panel-container {
right: 20px; /* Change position */
top: 100px;
}
Add More Stats
- Add property to AgentStats.cs
- Add stat item to AgentInfoPanel.uxml
- Add styling to AgentInfoPanel.uss
- Update AgentInfoPanel.cs DisplayAgentInfo method
Troubleshooting
Agents not clickable:
- Verify colliders are on agent GameObjects
- Check console for "OnMouseDown" debug messages
- Make sure agent GameObject is active
Info panel not showing:
- Verify UIDocument is assigned AgentInfoPanel.uxml
- Check console for errors in AgentInfoPanel.cs
- Ensure AgentInfoPanel GameObject is active
Names not showing:
- Verify AgentNameGenerator.cs exists in Scripts folder
- Check console for name generation errors
- Confirm agents are spawning
Stats all zero:
- Ensure AgentStats.cs is in Scripts folder
- Verify AIAgent initializes agentStats in Start()
- Check console for stat generation errors
Next Steps
- Add agent color coding by stats (e.g., red for high strength)
- Add animations when stats are displayed
- Add stat history/progression tracking
- Add agent trading or stat modification mechanics
- Add visual indicators on agents (badges for high stats)