private int numberOfAgents = 0; // current number of agents // Start is called before the first frame update void Start() { // initialize // gameFlowManager = this; // store the instance of this class in a public static field reducedVisibilityGraph = initManager.getReducedVisibilityGraph(); agentRadius = agentPrefab.GetComponent <SphereCollider>().radius *agentPrefab.transform.lossyScale.x; // radius in world space = local radius * scale // get the list that containing floors' 4corners as array floorCorners = generateFloorsList(floors); // run the initialize function for generateRandPointOnMap floorWeights = getFloorsWeights(floorCorners); //agentBody = testAgennt.GetComponent<Rigidbody>(); // generate numOfInitAgents agents initially for (int i = 0; i < numOfInitAgents; i++) { spawnAgent(floorCorners, floorWeights, agentsList, agentPrefab, goalPrefab, reducedVisibilityGraph, agentSpeed); } numberOfAgents = numOfInitAgents; }