public void OnOpenGalleryButtonClicked() { NativeGalleryController.OpenGallery((Texture2D tex, ExifOrientation orientation) => { orientationLabel.text = "Orientation: " + orientation; ShowTexture(tex); }); }
void Update() { if (_instance == null) { _instance = this; } }
public static void OpenGallery(System.Action <Texture2D, ExifOrientation> callback, bool rotateImportedImage, Tastybits.NativeGallery.ImagePickerType iOSImagePickerType) { if (NativeGalleryController.Verbose) { Debug.Log("Opening Image Picker"); } _callback = callback; #if UNITY_IPHONE && !UNITY_EDITOR if (NativeGalleryController.Verbose) { Debug.Log("Opening Image Picker - iOS"); } UIImagePicker.OpenPhotoAlbum((Texture2D texture, bool ok, string errMsg) => { _callback(texture, UIImagePicker.GetLastImportedOrientation()); }, rotateImportedImage, iOSImagePickerType); #elif UNITY_ANDROID && !UNITY_EDITOR if (NativeGalleryController.Verbose) { Debug.Log("Opening Image Picker - Android"); } AndroidGallery.OpenGallery((Texture2D tex) => { _callback(tex, AndroidGallery.GetLastImportedOrientation()); }, rotateImportedImage); #elif UNITY_EDITOR if (NativeGalleryController.Verbose) { Debug.Log("Opening Image Picker - Editor"); } NativeGalleryController.OpenEditorGallery(callback); #else Debug.LogError("OpenGallery: Function not implemented for platform " + Application.platform); #endif }
void OnDestroy() { if (_instance == this) { _instance = null; } }
/** * In the Unity Editor we can support recompile by using Update. */ #if UNITY_EDITOR void Update() { if (_instance == null && iAmSingleton) { _instance = this; } }
/** * * Initializese the component and makes sure that no more than 1 instance is created. * */ void Awake() { if (_instance != null && _instance != this) { Debug.LogWarning("The gameobject : " + this.name + " was destroyed since there is already an insteance of the Native Gallery Component loaded"); GameObject.DestroyImmediate(this.gameObject); return; } Object.DontDestroyOnLoad(this.gameObject); if (_instance == null) { _instance = this; } if (Time.frameCount < 3) { instance.gameObject.SetActive(false); } iAmSingleton = true; }
void Awake() { _instance = this; if (Time.frameCount < 3) { _instance.gameObject.SetActive(false); } }
public static void OpenGallery(System.Action <Texture2D> callback) { _callback = callback; #if UNITY_IPHONE && !UNITY_EDITOR UIImagePicker.OpenPhotoAlbum((Texture2D texture, bool ok, string errMsg) => { _callback(texture); }); #elif UNITY_ANDROID && !UNITY_EDITOR AndroidGallery.OpenGallery((Texture2D tex) => { _callback(tex); }); #elif UNITY_EDITOR NativeGalleryController.OpenEditorGallery(callback); #else Debug.LogError("OpenGallery: Function not implemented for platform " + Application.platform); #endif }
public void OnOpenGalleryButtonClicked() { NativeGalleryController.OpenGallery(( Texture2D tex ) => { ShowTexture(tex); }); }