public int AddNetwork(IInput[] inputs, IOutput[] outputs, NodeData[] hiddenNodes1, NodeData[] hiddenNodes2) { lock (_networkLock) { if (_activeNetworks >= _maxNetworks) { // NOTE: Perhaps the networks could be added to a queue? That way everything does get spawned and not just ignored Debug.LogError("Number of networks is exceeding the maximum allowed active networks. \nMax (" + _maxNetworks + ")"); return(-1); } _activeNetworks++; var inputID = _inputManager.AddNetwork(inputs); var hiddenLayer = _hiddenLayer.AddNetwork(hiddenNodes1); var outputLayer = _outputLayer.AddNetwork(hiddenNodes2); var outputID = _outputManager.AddNetwork(outputs); if (inputID != hiddenLayer || hiddenLayer != outputID) { Debug.LogError("Network ID mismatches. This should not be happening for any reason so there is a problem with the logic.\n" + "InputID: " + inputID + ", HiddenID: " + hiddenLayer + ", OutputID: " + outputID); } return(hiddenLayer); } }