c# - getting color value in given coordinates in a texture2D -


i googled quite time found responses on how other way, finding coordinates based on color.

this has been answered somewhere buried below of other responses.

--

so, simple way of making level editor game, have game load texture, , loop through pixels it. different colors in texture equate different objects.

everything else working fine, unable find how color of pixel in given co-ordinates.

basically need store texture color informations 1 dimensional array using texture2d.getdata method

var colortable = new color[texture.width*texture.height];         texture.getdata(colortable); 

then access specific pixel (let x,y) need corresponding color array

var pixelcolor=colortable[texture.width * y + x]; 

Comments