c# - Make texture2D readable in runtime/script Unity3D -
i have plugin allows me access pictures android phones gallery. gives me texture of texture2d type. want edit using getpixels function, not set readable default. how make texture readable can use getpixels on it?
basically allowing user select picture phone , crop it. in following example pic picture cropped red rectangle. works if make texture readable beforehand. http://puu.sh/mxr3h/dfa81719b2.jpg
if have files in project, can select texture in inspector, set texture type "advanced," set "read , write enabled" true.
if not, can try using getrawtexturedata() on texture have, create new texture same width , height , call loadimage() on new texture data got old one, making sure marknonreadable false. should able want on new texture , display while user cropping image.
http://docs.unity3d.com/scriptreference/texture2d.getrawtexturedata.html
Comments
Post a Comment