Creating an array of Color32 arrays
I have an array of RGBA values (a Color32 array) detected in a camera frame (webTexture) and I would like to store each individual frame's Color32[] array in one, bigger array-- I named it arrColors in the code below. How can I do this? (P.s.- I understand that Color32[] is technically a different "type" than byte[], but this it's just my ideas written out.)
private Color32[] colors;
private byte[] arrColors;
.......
void Start()
{
// Instantiate WebCamTexture and begin running camera
webTexture = new WebCamTexture();
webTexture.Play();
// Create new Color32 array with size of web camera's resolution and an array to hold up to [_STORAGE] indiviudal color arrays at a time
dimensions = webTexture.width * webTexture.height;
colors = new Color32[dimensions];
arrColors = new byte[dimensions * _STORAGE];
// Create a new Unity texture to apply webcam colors to
newTex = new Texture2D(webTexture.width, webTexture.height);
}
void Update()
{
// Get RGBA color values from current webTexture frame
webTexture.GetPixels32(colors);
// PSUEDO-LIKE CODE THAT NEEDS TO BE IMPLEMENTED
arrColors.Add(colors);
..........
}
Comment
Answer by tormentoarmagedoom · Jun 27, 2018 at 02:51 PM
Good day
I'm not familiarixed with them in Unity ,but what you need is a matrix... AS i said, i have no idea how to use them inside Unity , but im sure there are videos, tutorials, manuals, usermade scripts, etc...
Good luck!
Your answer
![](https://koobas.hobune.stream/wayback/20220612165602im_/https://answers.unity.com/themes/thub/images/avi.jpg)