void GeneratePixels() { byte[] fileData; string path; Texture2D tex; colorData = new Color[100, 10]; path = Path.Combine(new string[] { LoadedData.gameDataPath, "Datafiles", "2", "ImageAssets", "Bullet" }); path += ".png"; if (File.Exists(path)) { fileData = File.ReadAllBytes(path); tex = new Texture2D(1, 1); tex.LoadImage(fileData); //ImageConversion.LoadImage(tex, fileData); //display.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2()); colorData = ImageFileReader.ReadImageFile(tex.GetPixels()); } for (int i = 0; i < colorData.GetLength(0); i++) { for (int j = 0; j < colorData.GetLength(1); j++) { if (colorData[i, j].a > 0) { SpawnerOutput inst = CreatePixel(); LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Image>(inst).color = colorData[i, j]; inst.script.transform.localPosition = new Vector2(scaleFactor * i, scaleFactor * j) + pixelOffset; imageData[i, j] = inst; } } } }