実現したいこと
アプリ内でファイル名を指定して画面キャプチャを行い、メールなどで画像を送信してもファイル名が同じものであって欲しい。
発生している問題
届いた画像を確認するとリネームされている。
該当のソースコード
C#
1 string _FileName = "Test.png"; 2 string _FilePath { get {return Application.persistentDataPath + "/"+_FileName;}} 3 4 private IEnumerator ReadPixels() 5 { 6 // 以前のスクリーンショットを削除する 7 File.Delete(_FilePath); 8 9 // キャプチャした画像をテクスチャに貼り付ける 10 Texture2D texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, true); 11 yield return new WaitForEndOfFrame(); 12 texture.ReadPixels(new Rect(0,0,Screen.width, Screen.height), 0, 0, true); 13 texture.Apply(); 14 15 // png形式にエンコードをかける、テクスチャの消去 16 byte[] bytes = texture.EncodeToPNG(); 17 Object.Destroy(texture); 18 19 // キャプチャをアプリ内に保存、保存待ちの処理 20 File.WriteAllBytes(_FilePath, bytes); 21 while(true) { 22 if(File.Exists(_FilePath)) 23 break; 24 yield return null; 25 } 26 DebugFileList(GetFileList(Application.persistentDataPath)); 27 SocialConnector.SocialConnector.Share("Text","URL",_FilePath); 28 yield return null; 29 }
試したこと
・Gmailで送信→Gmailで確認
画像名が4~5桁位の数字に変更されている
・iPhone標準メールで送信→Gmailで確認
画像名が"Image-1"に変更されている
iPhoneの画像名の仕様や扱いについて分かるものがあればお聞きしたいです・・・
補足情報(FW/ツールのバージョンなど)
Unity2017.4.3f1
確認実機:iPhone7
あなたの回答
tips
プレビュー