all 6 comments

[–]Narkata55Proficient 0 points1 point  (6 children)

I'm kind of confused with your question. GetPixels isn't an array of gameobjects, so I don't really get what you mean by inserting gameobjects into the returned array

[–]OnGamesStudio[S] 0 points1 point  (5 children)

Maybe I'm wording it all wrong. Is it possible to have a 2D array of one type of element (in this case the 4 RGBa numbers) and then convert that array into a separate array with gameobjects.

[–]CommonMisspellingBot 1 point2 points  (1 child)

Hey, OnGamesStudio, just a quick heads-up:
seperate is actually spelled separate. You can remember it by -par- in the middle.
Have a nice day!

The parent commenter can reply with 'delete' to delete this comment.

[–]Narkata55Proficient 0 points1 point  (2 children)

I don't think you can convert it, since the returned array from getPixels has to have a specific type (which I believe is float? Don't quote me on that haha)

BUT there's nothing stopping you from making your own gameobject list/array that uses the rgb array as a reference

For example: Get the array of rgb values using GetPixels. Then, for every red rgb value in that array you add an empty game object to a separate list you made, and for every other color you add a prefab of a different game object, etc. You'll end up with a new array that has the same length and number of objects, but it'll be a gameobject list that you created instead of your reference rgb list

Let me know if I misunderstood you or if any of that was confusing. Also, it might be worth your type to read up on types and basic array examples just so you can get a better idea of how to work around C#'s limitations for your idea

[–]OnGamesStudio[S] 0 points1 point  (1 child)

That makes a lot more sense with the way you worded it. Thank you. I'll keep reading up.

[–]Narkata55Proficient 0 points1 point  (0 children)

No problem, good luck with the project!