// Start is called before the first frame update void Start() { results = new NeuralNetwork.Results(-1, 0f); images = new Image[gridSize * gridSize]; side = Mathf.RoundToInt(Screen.height / gridSize); Vector2 size = new Vector2(side, side); int i = 0; for (int y = 0; y < gridSize; y++) { for (int x = 0; x < gridSize; x++) { GameObject g = new GameObject(i.ToString(), new System.Type[] { typeof(Image) }); g.transform.SetParent(transform); g.layer = 5; images[i] = g.GetComponent <Image>(); RectTransform rt = g.GetComponent <RectTransform>(); rt.sizeDelta = size; rt.anchoredPosition = new Vector2((-gridSize / 2 * side) + x * side, (-gridSize / 2 * side) + y * side + (side / 2)); i++; } } }
//Hook to neural network IEnumerator GetNumberOnNeuralNetwork() { doingNeuralNetworkThings = false; results = nn.GetNumber(CompileTextureFromImages(images)); ready = true; yield return(null); }