---
title: "Hiding from the Player"
content_type: tutorial
url: "https://learn.unity.com/tutorial/hide-h1zl?language=en"
language: en
difficulty: intermediate
duration_minutes: 35
unity_version:
  - "6.0"
supported_unity_versions:
  - name: "6.0"
    url: "https://learn.unity.com/tutorial/hide-h1zl.md?language=en&version=6.0"
  - name: "2021.3"
    url: "https://learn.unity.com/tutorial/hide-h1zl.md?language=en&version=2021.3"
  - name: "2019.4"
    url: "https://learn.unity.com/tutorial/hide-h1zl.md?language=en&version=2019.4"
  - name: "2019.3"
    url: "https://learn.unity.com/tutorial/hide-h1zl.md?language=en&version=2019.3"
  - name: "2019.2"
    url: "https://learn.unity.com/tutorial/hide-h1zl.md?language=en&version=2019.2"
  - name: "2019.1"
    url: "https://learn.unity.com/tutorial/hide-h1zl.md?language=en&version=2019.1"
available_languages:
  - name: "en"
    url: "https://learn.unity.com/tutorial/hide-h1zl.md?language=en"
  - name: "ja"
    url: "https://learn.unity.com/tutorial/yin-reru.md?language=ja"
last_updated: "2026-08-04T14:23:23.000Z"
---

# Hiding from the Player

Learn to script a hide behavior so an agent finds better hiding spots behind obstacles while reducing Update method calls.

In this tutorial students will take a look at the basics behind the hide behaviour.  In it we will create a simple hide method that will have the agent hide behind the closest obstacle in the environment.  Next, students complete the development of the hiding behaviour and work to calculate a more accurate hiding location and reduce the number of calls to the method in the update.

## 1. Hiding from the Player Part 1

[Video](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/97cc6765-b069-5e6d-84c4-755acad7a5db/versions%5B_key==%22e50c62c2e480c367d0337010b48e059f%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxXM5Y%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxXM8b%22%5D.overviewVideo/S0805_20260320_054206.mp4) ([Transcript (en)](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/97cc6765-b069-5e6d-84c4-755acad7a5db/versions%5B_key==%22e50c62c2e480c367d0337010b48e059f%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxXM5Y%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxXM8b%22%5D.subtitles/S0805%20VTT%20en_20260525_213828.vtt))

In this tutorial, students will start to write an algorithm to have NPCs run and hide behind objects away from where the player is.

## 2. Hiding from the Player Part 2

[Video](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/97cc6765-b069-5e6d-84c4-755acad7a5db/versions%5B_key==%22e50c62c2e480c367d0337010b48e059f%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxXMHk%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxXMKn%22%5D.overviewVideo/S0806_20260410_213028.mp4) ([Transcript (en)](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/97cc6765-b069-5e6d-84c4-755acad7a5db/versions%5B_key==%22e50c62c2e480c367d0337010b48e059f%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxXMHk%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxXMKn%22%5D.subtitles/S0806%20VTT%20en_20260525_213838.vtt))

In this unit students continue the development of the hiding behaviour.
