Getting ready

This recipe requires some knowledge of custom editor scripting and an understanding of implementing the points of visibility graph representation. Also, it is worth mentioning that the script instantiates a CustomNavMesh game object automatically in the scene and it requires a prefab to be assigned, just like any other graph representation.

Finally, it's important to create the following class, deriving from GraphVisibility:

using UnityEngine; 
using System.Collections; 
using System.Collections.Generic; 
 
public class CustomNavMesh : GraphVisibility 
{ 
    public override void Start() 
    { 
        instIdToId = new Dictionary<int, int>(); 
    }    
} 

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.