- Home /
ReadPixels from RenderTexture in Flash
I need to get single pixel from RenderTexture. For every platform except Flash this is done by ReadPixels function. But in Flash it doesn't work. So what have I do to get this pixel in Flash? And yes, I need to do it every frame, so copying somehow the whole texture is not good solution.
Answer by Philipp · Mar 21, 2013 at 06:08 PM
Unfortunately, copying the complete screen is your only option.
Flash's stage3D currently doesn't have any capabilities of reading back the contents of a render texture into memory. All it provides is a method that takes a screenshot and writes its content into an AS3 BitmapData. If you search the forums for drawToBitmapData, you should find a few threads on the subject.
If doing this every frame is too expensive, maybe there's an alternate way of doing what you want to do. For instance, you could shoot a ray through the camera, check what object and what triangle it collides with, and then find the color of the object's texture at the position of intersection. All of that would, of course, depend on what you need that pixel color for, and what your scene looks like.
Your answer
![](https://koobas.hobune.stream/wayback/20220613094827im_/https://answers.unity.com/themes/thub/images/avi.jpg)