Curriculum
Course: How to develop 3D Games with Unity
Login
Video lesson

Resolving Ghost Issues – Understanding Nav Mesh Agents in Unity

 

Objectives 

  1. Resolve Ghost Movement Issues: Address and correct the problems causing the ghosts to move incorrectly or disappear in the game.
  2. Revisit Nav Mesh Agent Settings: Examine and adjust the navigational mesh agent settings to ensure proper movement of the ghosts along the baked surface of the game environment.
  3. Reconfigure Ghost Prefabs and Animations: Re-establish the ghost models, prefabs, and animations to ensure they function correctly in the game scene.
  4. Script and Waypoints Setup: Implement and test scripts for the ghosts, including defining and assigning waypoints for their movement paths.
  5. Game Testing and Debugging: Conduct thorough gameplay tests to identify and fix any issues with ghost behavior, movement, or game restarts upon player-ghost interactions.
  6. Enhance Gaming Experience: Explore and implement additional features or optimizations for an improved gaming experience.

 

Steps

  1. Revisit Nav Mesh Agent Settings:
    • Adjust the navigational mesh agent settings, ensuring it’s set correctly for ghost movement. This involves modifying parameters like agent radius and step height.
  2. Reconfigure Ghost Prefab and Animator:
    • Create or reestablish the ghost prefab in the hierarchy.
    • Add and configure an Animator Controller for the ghost, ensuring it includes necessary animations like ‘Ghost Walk’.
  3. Collider and Rigid Body Setup:
    • Attach a Capsule Collider and Rigid Body to the ghost prefab for collision and physics.
  4. Observer Script and Point of View Adjustment:
    • Implement the Observer script from the gargoyle setup onto the ghost.
    • Adjust the ‘Point of View’ object’s position and rotation to align with the ghost’s dimensions.
  5. Setup and Enable Nav Mesh Agent:
    • Add a Nav Mesh Agent component to the ghost, making sure it picks up the proper settings from the navigation setup.
    • Enable the Nav Mesh Agent for the ghost, ensuring it can use the pre-baked surface for movement.
  6. Implement Waypoint Patrol Script:
    • Create a new Waypoint Patrol script, defining variable arrays for waypoints.
    • Assign waypoints to the ghost, starting with a single ghost for initial testing.
  7. Test Ghost Movement and Script Functionality:
    • Conduct tests to ensure the ghost moves along the defined waypoints.
    • Continuously adjust and retest, focusing on the ghost’s interactions and pathfinding.
  8. Duplicate Ghosts and Waypoints:
    • Once the initial ghost setup is successful, duplicate ghosts and waypoints as required by the game design.
    • Adjust the position of each ghost and its corresponding waypoints.
  9. Final Testing and Adjustments:
    • Run the game to test the complete setup of dynamic observers.
    • Make any necessary adjustments based on testing outcomes.
  10. Save Progress and Iterate:
  • Regularly save different scenes for easy reference and potential rollback.
  • Iterate on the setup to refine ghost behavior and interactions.