private void SetFileName(string path) { receivedMimeType = selectedMimeType; shareFile = path; data.imageSetter = x => share = x; switch (selectedMimeType) { case 1: //video //load a preview picker.GetVideoPreview(data, shareFile); break; case 0: //image StartCoroutine(ImagePicker.LoadImage(shareFile, data.imageSetter)); break; default: Debug.LogWarning("Implement your mimetype handling here"); break; } }