cantautora
cantautora

Reputation: 11

Load and save files in Unity, C#

I'm trying to save a file and after a while send it by email. When I am testing my app using my laptop the file is saved and send it, however when I am testing my app using my Android it doesn't work, and I can check that the file is saved properly.

I am saving and loading the file in this path:

private string getPath(){
    //return Application.persistentDataPath + "/" + FILE_PATH;
    #if UNITY_EDITOR
        return Application.dataPath +"/"+FILE_PATH;
    #elif UNITY_ANDROID
        return Application.persistentDataPath+"/"+FILE_PATH;
    #elif UNITY_IPHONE
        return Application.persistentDataPath+"/"+FILE_PATH;
    #else
        return Application.dataPath +"/"+FILE_PATH;
    #endif
}

And in player configuration of Android I have set:

image

And I'm send it:

System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment (getPath());
message.Attachments.Add (attachment);

Where is my error? Thanks for all.

Upvotes: 0

Views: 516

Answers (1)

cantautora
cantautora

Reputation: 11

The problem it was in Net 2.0 Subnet. I have to choose Net 2.0

Thanks for all

Upvotes: 1

Related Questions