[U3DXT] iOS UIImagePickerController a few smart tricks…

Uhhh, I’m so exhausted with that U3DXT ImagePicker, it works… heavily.

I listed some useful tricks for problems like: Memory Warning, Loading Rotated Image..

1. Memory Warning(dumb but there’s only one)

I really don’t know why U3DXT haven’t done anything with this memory leak, but ok. So the issue shows when we trying to load more than 1,2 images at the same time. The problem shows beacuase of U3DXT still holds loaded images in our memory(even we Destroy Texutre2D). I found only one solution, it can seem dumb and crazy but i couldn’t think over anything better. So the secret of this magic trick is…

Reaload scene

Haha, seriously! Only one thing can pretend us from memory warning and it’s reloading scene with every showing UIPickerController. So remember: every time after loading image from imagePicker save it in PlayerPrefs and reload scene!


2.Images are loading upside down.

The only one solution i have founded is getting image orientation prefs from plugin and… rotate this Texture2D it by code(will post how to do that soon).

So we have to use my special code:

void OnMediaPicked(object sender, MediaPickedEventArgs e)
loadedImage = e.image.ToTexture2D();
string ortientation = e.image.imageOrientation.ToString();
if (ortientation == "Right")
RotateImage (-90);
else if (ortientation == "Down")
RotateImage (180);
else if (ortientation == "Left")
RotateImage (90);

Hope so that helped u, cheers 😉