Plugin version 4.3.29 PRO
Unity version 20.1b16
After adding point node to graph, they are not visible in scene view
Code
for (int i = 0; i < demand.NodeToAdd.Length; i++)
{
var pos = demand.NodeToAdd[i];
var node = _pointNodePool.RemoveLast();
//target graph index is 1
if (node.GraphIndex == 0)
graph.AddNode(node, (Int3)(Vector3)GridHelper.GridToWorldSpace(pos));
Debug.Log($"Add node at {(Int3)(Vector3)GridHelper.GridToWorldSpace(pos)}");
var posNorth = (Vector3)GridHelper.GridToWorldSpace(pos + new int3(0, 0, 1));
var posEast = (Vector3)GridHelper.GridToWorldSpace(pos + new int3(1, 0, 0));
var posSouth = (Vector3)GridHelper.GridToWorldSpace(pos + new int3(0, 0, -1));
var posWest = (Vector3)GridHelper.GridToWorldSpace(pos + new int3(-1, 0, 0));
var northResult = graph.GetNearest(posNorth);
//make sure we have a result and it's the good node
if (northResult.node != null && northResult.node.position == (Int3)posNorth)
{
northResult.node.AddConnection(node, NodeDefaultCost);
node.AddConnection(northResult.node, NodeDefaultCost);
}
var eastResult = graph.GetNearest(posNorth);
if (eastResult.node != null && eastResult.node.position == (Int3)posEast)
{
eastResult.node.AddConnection(node, NodeDefaultCost);
node.AddConnection(eastResult.node, NodeDefaultCost);
}
var southResult = graph.GetNearest(posNorth);
if (southResult.node != null && southResult.node.position == (Int3)posSouth)
{
southResult.node.AddConnection(node, NodeDefaultCost);
node.AddConnection(southResult.node, NodeDefaultCost);
}
var westResult = graph.GetNearest(posNorth);
if (westResult.node != null && westResult.node.position == (Int3)posWest)
{
westResult.node.AddConnection(node, NodeDefaultCost);
node.AddConnection(westResult.node, NodeDefaultCost);
}
}
}
graph.RebuildNodeLookup();
}));