Unity 2018 Artificial Intelligence Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

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>(); 
    }    
}