C# 如何使用android+;统一

C# 如何使用android+;统一,c#,android,pdf,download,unity3d,C#,Android,Pdf,Download,Unity3d,我正在尝试从Web服务器下载一个文件(pdf文件)并保存到我的sd卡中,或者直接将此文件存档并发送电子邮件,然后再发送电子邮件 我的应用程序需要向一些学生发送带有pdf格式信息的电子邮件。我已经发送了带有主题和内容的电子邮件,但由于我使用的是unity+android,我无法下载和/或阅读pdf文件 我正在尝试WWW课程,但不起作用 if(loadInfo.getPantallaActual().Equals("pantallaInicio")) { Email objEmail =

我正在尝试从Web服务器下载一个文件(pdf文件)并保存到我的sd卡中,或者直接将此文件存档并发送电子邮件,然后再发送电子邮件

我的应用程序需要向一些学生发送带有pdf格式信息的电子邮件。我已经发送了带有主题和内容的电子邮件,但由于我使用的是unity+android,我无法下载和/或阅读pdf文件

我正在尝试WWW课程,但不起作用

if(loadInfo.getPantallaActual().Equals("pantallaInicio"))
{   
Email objEmail =    LoadCarreras.objXML.objCarrera.GetEmail();
string to = "to@hotmail.com";
string from = "from@gmail.com";
string subject =     objEmail.GetAsunto();
string body = objEmail.GetCuerpo();
string urlAttachment =   objEmail.GetContenido_url();
StartCoroutine(descarga(urlAttachment));
archivo =    Path.GetFileName(urlAttachment);
File.CreateText(Application.persistentDataPath + "/"+archivo);
                    Debug.Log(" urlAttachment "+urlAttachment);
                    Debug.Log(" archivo "+archivo);
                    Debug.Log(" persistentDataPath "+Application.persistentDataPath + "/"+archivo);

                         message = new MailMessage(from, to, subject, body);


                        SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                        client.EnableSsl = true;
                        client.UseDefaultCredentials = false;
                        client.Credentials = (ICredentialsByHost) new System.Net.NetworkCredential("from@gmail.com", "pasw.");
                        client.DeliveryMethod = SmtpDeliveryMethod.Network; 
                        client.Timeout = 10000;

                        ServicePointManager.ServerCertificateValidationCallback = 
                        delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
                            { return true; };

                        try {
                            client.Send(message);
                        }
                            catch (System.Exception ex) {
                            Debug.Log("Exception caught in CreateTestMessage1(): "+ex.ToString() );
                        }   


public IEnumerator descarga(string url){

    descargaA = new WWW(url);
    mandarEmail = true; 
    yield return descargaA;
}
void Update () {
    if(mandarEmail)
    {
        if(descargaA.isDone && cambiar){


            message.Attachments.Add (new Attachment(Application.persistentDataPath + "/"+"file.pdf"));  
            cambiar = false;
        }
    }       
}

什么不起作用?是否收到错误?是IOException:路径C:\Users\jonymanolo\AppData\LocalLow\UDEM\carreRA\ArchivoAdunto.pdfSo上的共享冲突问题出在函数“descarga”中?或者抛出异常的位置。您是否尝试过将其保存到另一个路径:C:\bla.pdfi需要保存在Android的sd卡上unity标记用于Microsoft unity。请不要误用它。