- Home /
U3DXT crash when converting image to Texture2D
I'm trying use U3DXT to pick an image from the Camera Roll and load it into a texture, but my app crashes after selecting an image.
My Unity script contains:
void OnMediaPicked(object sender, MediaPickedEventArgs e)
{
Debug.Log("Image picked: " + e.image);
Debug.Log(" converting to texture2d...");
Texture2D texture = e.image.ToTexture2D();
Debug.Log(" converted!");
Here is the debug output when I run my app from XCode:
Image picked: [UIImage: Uuid=6E0F1E27-E85E-47E4-B004-CC3780EE6DAD]
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
FilePicker:OnMediaPicked(Object, MediaPickedEventArgs)
U3DXT.iOS.GUI.GUIXT:_OnPickedMedia(Object, DidFinishPickingMediaWithInfoEventArgs)
U3DXT.iOS.Native.UIKit._UIImagePickerControllerDelegate:DidFinishPickingMediaWithInfo(UIImagePickerController, Dictionary`2)
U3DXT.iOS.Native.UIKit.<_set__imagePickerController_didFinishPickingMediaWithInfo__handler_value_callback>c__AnonStoreyC:<>m__C()
U3DXT.Core.CoreXT:RunOnMainThread(Action)
U3DXT.iOS.Native.UIKit.UIImagePickerControllerDelegate:_set__imagePickerController_didFinishPickingMediaWithInfo__handler_value_callback(Delegate, Dictionary`2)
U3DXT.iOS.Native.Internals._CallbackCache:_Callback(String, String)
(Filename: /Users/builduser/buildslave/unity/build/artifacts/iPhonePlayer-armv7Generated/UnityEngineDebug.cpp Line: 56)
converting to texture2d...
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
FilePicker:OnMediaPicked(Object, MediaPickedEventArgs)
U3DXT.iOS.GUI.GUIXT:_OnPickedMedia(Object, DidFinishPickingMediaWithInfoEventArgs)
U3DXT.iOS.Native.UIKit._UIImagePickerControllerDelegate:DidFinishPickingMediaWithInfo(UIImagePickerController, Dictionary`2)
U3DXT.iOS.Native.UIKit.<_set__imagePickerController_didFinishPickingMediaWithInfo__handler_value_callback>c__AnonStoreyC:<>m__C()
U3DXT.Core.CoreXT:RunOnMainThread(Action)
U3DXT.iOS.Native.UIKit.UIImagePickerControllerDelegate:_set__imagePickerController_didFinishPickingMediaWithInfo__handler_value_callback(Delegate, Dictionary`2)
U3DXT.iOS.Native.Internals._CallbackCache:_Callback(String, String)
(Filename: /Users/builduser/buildslave/unity/build/artifacts/iPhonePlayer-armv7Generated/UnityEngineDebug.cpp Line: 56)
I generated the project from the Windows version of Unity. The project already has a reference to the UIKit framework. I copied libU3DXTCore.a to the libraries folder to get the project to build.
Any ideas? I'm using the latest version of the asset (v1.7.1.2) with Xcode v6.2 on OSX 10.10.2. My test device is an iPod Touch (4th gen).
Your answer
![](https://koobas.hobune.stream/wayback/20220613193328im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
U3DXT Init failed, everything is setup 1 Answer
Using MediaExporter to save to MP3 1 Answer
U3DXT IAP - prevent pending transactions from starting download after Init() 1 Answer
Save and show image in iPhone Gallery 0 Answers
U3DXT AVAudioPlayer 0 Answers