Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // fill the color maps with the 2D arrays of pixel colors
- currentBuild.pixelColorMaps = new Color[textureList.Length][,];
- for (int currentTextureIndex = 0; currentTextureIndex < textureList.Length; currentTextureIndex++)
- {
- Texture2D currentTexture = textureList[currentTextureIndex];
- currentBuild.pixelColorMaps[currentTextureIndex] = new Color[currentTexture.width,currentTexture.height];
- Color[] flattenedColorMap = currentTexture.GetPixels();
- for (int currentPixelIndex = 0; currentPixelIndex < flattenedColorMap.Length; currentPixelIndex++)
- {
- int xIndex = currentPixelIndex % currentTexture.width;
- int yIndex = currentPixelIndex / currentTexture.height;
- currentBuild.pixelColorMaps[currentTextureIndex][xIndex,yIndex] = flattenedColorMap[currentPixelIndex];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement