- Home /
Etcetera: promptForPictureFromAlbum
Hello,
I am trying to use the function promptForPictureFromAlbum from Etcetera plugin on Android and I am running into weird behavior.
At times, it works as it should and presents the album and on a photo selection routes me back to the game. But sometimes, after a photo selection from the album, it pops up another alert for photo selection and on either pressing the back button on Android or selecting another photo, the application crashes. Also, I do not get a albumChooserSucceededEvent in the second case.
Below are few lines of code that I am using:
Please note: I am also using PromptToTakePhoto and it works perfectly fine.
void Start () { EtceteraAndroid.initTTS (); }
void OnEnable ()
{
EtceteraAndroidManager.albumChooserSucceededEvent += textureLoaded;
EtceteraAndroidManager.photoChooserSucceededEvent += textureLoaded;
Debug.Log ("OnEnable");
}
void OnDisable ()
{
EtceteraAndroidManager.albumChooserSucceededEvent -= textureLoaded;
EtceteraAndroidManager.photoChooserSucceededEvent -= textureLoaded;
Debug.Log ("OnDisable");
}
void OnAlbumClick ()
{
string name = "CustomImage_" + (GlobalData.imageCount + 1) + ".png";
EtceteraAndroid.promptForPictureFromAlbum(1024, 768, name);
Debug.Log ("OnAlbumClick");
}
void OnCameraClick ()
{
string name = "CustomImage_" + (GlobalData.imageCount + 1) + ".png";
EtceteraAndroid.promptToTakePhoto(1024, 768, name );
Debug.Log ("OnCameraClick");
}
public void textureLoaded (string imagePath, Texture2D texture)
{
Debug.Log("textureLoaded");
Save (texture, imagePath);
}
Comment