public void generateBuilding(int index, int x, int y) { Color c = inputMap.GetPixel(x, y); if (c.grayscale != 0) { GameObject house = Instantiate(houseBase, new Vector3(x * houseWidth + 1, 0, y * houseHeight + 1), Quaternion.identity); stockComponent = house.GetComponent <Demo.Stock>(); parameComponent = house.GetComponent <Demo.BuildingParameters>(); stockComponent.Width = houseWidth - 1; stockComponent.Depth = houseHeight - 1; parameComponent.maxHeight = (int)(c.grayscale * 256f) / 20; stockComponent.Generate(); } }