Pathfinding.GridGraph.PostDeserialization C# (CSharp) Method

PostDeserialization() public method

public PostDeserialization ( ) : void
return void
        public override void PostDeserialization()
        {
            GenerateMatrix ();

            SetUpOffsetsAndCosts ();

            if (nodes == null || nodes.Length == 0) return;

            if (width*depth != nodes.Length) {
                Debug.LogWarning ("Node data did not match with bounds data. Probably a change to the bounds/width/depth data was made after scanning the graph just prior to saving it. Nodes will be discarded");
                nodes = new GridNode[0];
                return;
            }

            //graphNodes = new GridNode[nodes.Length];

            int gridIndex = GridNode.SetGridGraph (this);

            for (int z = 0; z < depth; z ++) {
                for (int x = 0; x < width; x++) {

                    GridNode node = nodes[z*width+x] as GridNode;

                    if (node == null) {
                        Debug.LogError ("Deserialization Error : Couldn't cast the node to the appropriate type - GridGenerator. Check the CreateNodes function");
                        return;
                    }

                    node.SetIndex  (z*width+x);
                    node.SetGridIndex (gridIndex);
                }
            }
        }