Search Unity

Easy Save - The Complete Save Data & Serialization Asset

Discussion in 'Assets and Asset Store' started by JoelAtMoodkie, May 28, 2011.

  1. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    It essentially adds an extra field. When you append using tags, you need to use the LoadAll methods to load your data. For example, if you save and load like this:
    Code (csharp):
    1. ES2.Save(100, "myFile.txt?tag=myTag&savemode=append");
    2. ES2.Save(200, "myFile.txt?tag=myTag&savemode=append");
    3. int[] myArray = ES2.LoadAll<int>("myFile.txt?tag=myTag");
    myArray will be an array containing 100 and 200, which are the values we saved.

    Hope this helps :)
     
  2. kenshako

    kenshako

    Joined:
    Jun 19, 2012
    Posts:
    5
    Hi joeltebbett
    when I call EasySave.* ( any functions ) , the console will note note error: BCE0005: Unknown identifier: 'EasySave', but ES2.* is work well.
    please help!
    thank you so much!

    By the way, I want to use old version's File/Folder functions, because new ES2 not have these:
    EasySave.deleteFile()
    EasySave.fileExists()
    EasySave.getFiles()
    and so on ....
     
    Last edited: Jul 3, 2012
  3. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi Kenshako,

    Try putting the EasySave.cs file in a folder named "Standard Assets".

    All the best,
    Joel
     
  4. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    Hi Joel,

    Bought the package, it looks great. Just trying to get something really simple setup in Javascript. I'm not after auto save monitoring, and want to save/load in specific data, so I fixed up the function you provided someone else to be in Javascript:

    Code (csharp):
    1. #pragma strict
    2.  
    3. public var id : int; // This allows us to uniquely identify this Unit.
    4. public var path : String  = "D:\\Game Development\\Assets\\_testsaves\\saveFile.txt"; // Where we want to save our data.
    5.  
    6. public var hp : int;
    7. public var move: int;
    8. public var damage : int;
    9.  
    10. function Start () {
    11.     Load();
    12.     Debug.Log(hp + " " + move + " " + damage);
    13.     Save();
    14.  
    15. }
    16.  
    17. function Update () {
    18.  
    19. }
    20.  
    21. // This handles the saving of an item.
    22.  
    23. public function Save():void
    24. {
    25.     var pathWithID : String = path+"?tag="+id; // Create our path.
    26.     // Now we save our variables.
    27.     ES2.Save(hp, pathWithID+"hp");
    28.     ES2.Save(hp, pathWithID+"move");
    29.     ES2.Save(hp, pathWithID+"damage");
    30. }
    31.  
    32. // This handles the loading of an item.
    33. public function Load():void
    34. {
    35.     var pathWithID : String = path+"?tag="+id; // Create our path.
    36.  
    37.     // If there's no data to load, do nothing.
    38.  
    39.     if(!ES2.Exists(pathWithID+"hp"))
    40.     {
    41.         return;
    42.     }
    43.  
    44.     // Now we load our variables.
    45.     hp = ES2.Load.<int>(pathWithID+"hp");
    46.     move = ES2.Load.<int>(pathWithID+"move");
    47.     damage = ES2.Load.<int>(pathWithID+"damage");
    48. }
    But while I'm not getting any errors, I'm also not getting a file, wondered if you had any ideas? Any help is appreciated. I should also mention I haven't put any ES2 files on any game objects, am running solely from the scripts, but I assumed this shouldn't be a problem?
     
  5. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi gumboots,

    By default Easy Save saves to PlayerPrefs, as saving to an actual file isn't supported on Web Player. To save to file, you can modify the code so that it supplies an ES2Settings object when saving, loading and using ES2.Exists. I've done the work for you here :)

    Code (csharp):
    1. #pragma strict
    2.  
    3. public var id : int; // This allows us to uniquely identify this Unit.
    4. private var path : String  = "D:/Game Development/Assets/_testsaves/saveFile.txt"; // Where we want to save our data.
    5.  
    6. public var hp : int;
    7. public var move: int;
    8. public var damage : int;
    9. private var settings : ES2Settings;
    10.  
    11. function Start ()
    12. {
    13.     // Create our settings object and set the save location to File.
    14.     settings = new ES2Settings();
    15.     settings.saveLocation = ES2.SaveLocation.File;
    16.    
    17.     Load();
    18.     Debug.Log(hp + " " + move + " " + damage);
    19.     Save();
    20. }
    21.  
    22. function Update () {
    23. }
    24.  
    25. // This handles the saving of an item.
    26. public function Save():void
    27. {
    28.     var pathWithID : String = path+"?tag="+id; // Create our path.
    29.     // Now we save our variables.
    30.     ES2.Save(hp, pathWithID+"hp", settings);
    31.     ES2.Save(hp, pathWithID+"move", settings);
    32.     ES2.Save(hp, pathWithID+"damage", settings);
    33. }
    34.  
    35. // This handles the loading of an item.
    36. public function Load():void
    37. {
    38.     var pathWithID : String = path+"?tag="+id; // Create our path.
    39.     // If there's no data to load, do nothing.
    40.     if(!ES2.Exists(pathWithID+"hp", settings))
    41.     {
    42.         return;
    43.     }
    44.  
    45.     // Now we load our variables.
    46.     hp = ES2.Load.<int>(pathWithID+"hp", settings);
    47.     move = ES2.Load.<int>(pathWithID+"move", settings);
    48.     damage = ES2.Load.<int>(pathWithID+"damage", settings);
    49. }
    I've also changed your path so that it uses singular forward slashes, though this is not essential. I've tested it at my end and it should work great!

    All the best,
    Joel
     
  6. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    I've written a reply twice already and it won't seem to post! Third time lucky, hehe.

    Thanks heaps, that works perfectly, though we were both saving all the same data to each identifier, hehe.

    Is there any reason not to have extensionless files? Rather than .txt? An extra deterrent atop the encryption.

    Additionally, I'm intending on storing NPC dialogue in saved files, writing them in a scene, saving the files, then in game just loading them as the respective scene is loaded. Either as a series of strings, or an array of strings, if this is an acceptable format. Can you see any performance or other issues with this?
     
  7. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    It's not the first time I've made that mistake when copy/pasting code, and I certainly doubt it'll be the last :D

    The main reason for an extension is to let Easy Save know that our path leads to a file, and not a folder. You can however set the extension to whatever you want: I tend to use '.txt' or '.file' in my examples as they're more descriptive.

    Easy Save is relatively quick, so there shouldn't be any problem with this, especially if you do it as an array (meaning that you only need to make a single ES2.Load call).

    However, an even easier way might be just to create an 'NPCDialog' class with a public String array and enter the pieces of dialog into this inside of Unity. Then on Awake, you could transfer this array to a static array which you can access from anywhere. This class would look something like this:
    Code (csharp):
    1. #pragma strict
    2.  
    3. // We assign to this inside of Unity.
    4. public var dialogArray : String[];
    5. static var staticDialogArray : String[];
    6.  
    7. public function Awake()
    8. {
    9.     staticDialogArray = dialogArray;
    10.     // Delete our instance so it doesn't take up memory.
    11.     Destroy(this.gameObject);
    12. }
    13.  
    14. // Gets the piece of dialog at a given position in the array.
    15. static function GetDialog(index : int) : String
    16. {
    17.     return staticDialogArray[index];
    18. }
    And you could get the 12th entry in the dialog array using the code:
    Code (csharp):
    1. NPCDialog.GetDialog(12);
    That's how I transfer things from the Unity Editor to static variables anyway. If you find the Easy Save way easier, do it the Easy Save way :)
     
  8. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    Wow, more than happy to try something else, thanks heaps for your help! If I could pick your brain a tiny bit more, understanding this is way out of the scope of an EasySave purchase..

    So that script you wrote is in a Javascript file attached to an empty game object? Destroying the game object doesn't destroy the script attached to it? That's something I was unaware of. Or am I not understanding the process right?

    Thanks so much again for the help! Please don't feel obliged to provide support outside of your product if you don't want to!

    -------
    EDIT
    -------

    Ok, so I did some reading on arrays and static arrays, probably a good idea! Heh. However if you enter all the dialogue in to the inspector in an array, isn't it static already? What is the benefit of the transfer? And I'm still struggling to comprehend the game object deletion haha
     
    Last edited: Jul 5, 2012
  9. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Not a problem, I'm always happy to help when I've got time :)

    When you destroy a GameObject it also destroys the script instances associated with that GameObject. However, static variables are not linked to any particular instance, and therefore are never destroyed.

    When you enter details into an array in the Unity Editor, it is linked to that script instance. You can't assign to static variables inside the Unity Editor (yet).

    The advantage of transferring the data to a static variable is that you don't need to have a reference to the script instance which contains your data; the data is global, so it can be easily accessed from any script. Another way to do it would be to forget about the static variable and static function, and simply store a reference to your NPCDialogue script.
     
  10. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi, I'm wondering if there is a way to save a gameobject's material(s) using Easy Save? On your website I found that one of the supported data types is texture2D so I assume that means that textures can be saved, correct?
     
  11. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    Oh, I had no idea that that was a feature of a static function/variable. How useful! I've also just been reading up on classes, not attached to anything, for example:

    Code (csharp):
    1. class NPCDialogue {
    2.     public function hey():String{
    3.         return "Hey";
    4.     }
    5. }
    This seems like a similar concept, without needing to create the GameObject in the first place? I suppose the down side is that you can't use the inspector to edit values. What's your opinion on this method? (Having a built in array in a class)

    P.S. Easy Save is wild, as is your support!
     
  12. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi Hamesh81,

    You can save Texture2D's. You can't currently save the entire material, but we've just added this to our To Do list.

    All the best,
    Joel
     
  13. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Actually when you create a script in Unity, you are creating a class. For example, creating a Javascript script containing this:
    Code (csharp):
    1. class NPCDialogue {
    2.     public function hey():String{
    3.         return "Hey";
    4.     }
    5. }
    Is exactly the same as creating a Javascript script containing just this:
    Code (csharp):
    1. public function hey():String{
    2.         return "Hey";
    3.     }
    This is because Unity always presumes that it contains a class anyway, and uses the script's name as the class name. Both ways require you to create a GameObject and attach your script to it. If you wanted a static class, you could simply create a class which only contains static variables and functions.
     
  14. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Thanks for that, I will probably need to switch out materials with different shaders which is why I'd need to save the entire material. Looking forward to this feature when it's added :) When saving out Texture2D's is it possible to save multiple images for one gameobject? For example if I'm using a shader which has a diffuse map, a normal map and a transparency map could all three of these be saved and loaded again?
     
    Last edited: Jul 6, 2012
  15. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    That is certainly possible. You'd just save each Texture separately using ES2.Save() and then Load and Reassign them separately using ES2.Load<Texture2D>().

    For the time being you could also save the name of the shader, and then use Shader.Find(ES2.Load<string>()) to load the shader.

    All the best,
    Joel
     
  16. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    Thanks so much for your help!
     
  17. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    317
    If I append a few time and have, say, 4 fields under one tag, how would I go about saving only the second field in the tag if that's the only value that changed, and still maintain all the other fields?
     
  18. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    We're currently working on a function which allows you to load the 1st/2nd/3rd/etc tag. For the time being, it might be easier to append a number to the tag and use that as the id.
    For example:
    Code (csharp):
    1. ES2.Save("myData1", "myFile.txt?tag=myTag1");
    2. ES2.Save("myData2", "myFile.txt?tag=myTag2");
    3. ES2.Save("myData3", "myFile.txt?tag=myTag3");
    All the best,
    Joel
     
  19. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    317
    Thanks for the reply!

    Is it possible to save var types yet?
     
  20. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    I'm not sure what you mean. A var isn't a type, it's just a keyword for a variable. When you declare a var in Javascript, it must be assigned a type. If not using 'pragma strict', Javascript automatically tries to work out what type the var should be.

    For example:
    Code (csharp):
    1. var myVariable = "This is a string";
    is the same as writing:
    Code (csharp):
    1. var myVariable : String = "This is a string";
    In both cases, the var is a String.
     
  21. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    317
    Ah I see, thanks for the confirmation. =)
     
  22. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    317
    I'm trying to delete a file and my code looks like this:

    Code (csharp):
    1. if(EasySave.fileExistsAtPath(savePath+fileName))
    2.         {
    3.             EasySave.deleteFile(savePath+fileName);
    4.         }
    Why does the if statement return true to try and delete the file, then I get an error when actually trying to delete it saying that it doesn't exist?

    Also tried with ES2.Delete(savePath+fileName), but that also wouldn't delete the file.

    I'm able to load the file just fine and pull tagged data from it. Also, the files are encrypted.
     
    Last edited: Jul 8, 2012
  23. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi disastercake,

    What are your savePath and fileName variables set to?

    All the best,
    Joel
     
  24. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    317
    Here's what the delete code looks like that doesn't work: (Note, neither the EasySave nor the ES2 functions are working)

    Code (csharp):
    1.  
    2. private static string savePath = Application.dataPath +"/../";
    3.  
    4. public static void DeleteGame(int saveSlot)
    5.     {
    6.         if(EasySave.fileExistsAtPath(savePath + "savedata" + saveSlot + ".txt"))
    7.         {
    8.             //EasySave.deleteFile(savePath + "savedata" + saveSlot + ".txt");
    9.             ES2.Delete(savePath + "savedata" + saveSlot + ".txt");
    10.         }
    11.     }
    12.  
    Here's what the load code looks like that does work:
    Code (csharp):
    1.  
    2.  
    3. public static MainMenuGUI.LoadPreviewData LoadGamePreview(int saveSlot)
    4.     {
    5.         // Loads specific data for a specified saved game
    6.         // so it can be displayed for the user in the Main Menu / Start Game Menu GUI
    7.         MainMenuGUI.LoadPreviewData previewData = new MainMenuGUI.LoadPreviewData();
    8.        
    9.         if(EasySave.fileExistsAtPath(savePath + "savedata" + saveSlot + ".txt"))
    10.         {
    11.             previewData.name = ES2.Load<string>(savePath + "savedata" + saveSlot + ".txt" +  "?tag=playerName&encrypt=true", GameManager.Instance.SaveSettings);
    12.         }
    13.        
    14.         return previewData;
    15.     }
    16.  
    17.  
    This uses the same class level variable savePath as the delete function.


    Here is the code that does work for the saving of the file: (same savePath variable as the code above)
    Code (csharp):
    1.  
    2. public static void CreateNewSaveData(int saveSlot, string name)
    3.     {
    4.         ES2.Save(name,
    5.                 savePath + "savedata" + saveSlot.ToString() + ".txt?tag=playerName&encrypt=true",
    6.                 GameManager.Instance.SaveSettings);
    7.     }
    8.  
    I can actually see this file in the correct path with the .exe in it.

    Here is the code for settings to the SaveSettings
    Code (csharp):
    1.  
    2. private ES2Settings _saveSettings;
    3. public ES2Settings SaveSettings
    4.     {
    5.         get{ return _saveSettings;}
    6.         set{ // Does not need a setter because the private is the one
    7.               // that is directly initialized.
    8.         }
    9.     }
    10.  
    11. void InitialSaveSettings()
    12.     {
    13.         // Set the settings for the saving and loading of data
    14.         _saveSettings = new ES2Settings();
    15.         _saveSettings.saveLocation = ES2.SaveLocation.File;
    16.         _saveSettings.encryptionPassword = "S$@D5F324Rwerf#@$324DDWE123#@$";
    17.     }
    18.  
     
    Last edited: Jul 8, 2012
  25. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi disastercake,

    Much like the Save/Load methods, by default it looks in PlayerPrefs. You need to tell it that you're using File as your save location.

    Code (csharp):
    1.  ES2.Delete(savePath + "savedata" + saveSlot + ".txt?savelocation=file");
    Hopefully that should solve your problem. Let us know how you get on!
     
  26. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    317
    Works great now, thank! Why can't I pass a settings variable to the delete function to specify the file setting?
     
    Last edited: Jul 9, 2012
  27. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    We thought we had implemented this function but clearly not. It'll be in the next update!
     
  28. Memory-Noise

    Memory-Noise

    Joined:
    Jan 17, 2011
    Posts:
    16
    Just a small question: is there a way to pass a TextAsset object to some kind of Load() method? for example, to deserialize something that's already in memory, or tored inside Resource folder and passed with Resource.Load().
     
  29. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Currently you would need to save the TextAsset using SaveRaw(), and then load it that way. However, a more suitable method may be included in a future update.
     
  30. nia1701

    nia1701

    Joined:
    Jun 8, 2012
    Posts:
    74
    Hi Joel, I sent an email to you about this but thought i'd post here in case others want the answer too:
    I have a variable that is type Transform. That variable is the Transform of a specific gameobject that can change during the game via script. I need to save which gameobject the transform is coming from and load that with ES2. Currently ES2 will load a New Gameobject instead of applying the saved transform back the variable i'm trying to set it back to....here is the code with the variable:

    Code (csharp):
    1. var target : Transform;
    2. function Update()
    3. {
    4. var targetDir = target.position;
    5. }
    the var target can get updated to a be associated with a new gameobject via code at different points so I need to save that information. Is that clear? Am I doing this wrong in the first place?

    Thanks!
     
  31. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi there,

    You need to use the self-assigning Load method which accepts a Component as a parameter. Documentation for this can be found here.

    All the best,
    Joel
     
  32. nia1701

    nia1701

    Joined:
    Jun 8, 2012
    Posts:
    74
    Thanks for the reply!
    I think perhaps I was not clear enough because I am still not getting the desired results....

    here is a photo of what I want....
    $Untitled-2.jpg

    the circled transform could change during the game to lets say "Cam (Transform)"
    If I save while it says "Bik (Transform), when I reload I want it to say "Bik (Transform)".
    Currently I tried this:
    Code (csharp):
    1. public void Save(){
    2.             ES2.Save(target, "save.sav?tag="+gameObject.name+"target");
    3.        
    4.     }
    then if I load with this:
    Code (csharp):
    1.  target= ES2.Load<Transform>("save.sav?tag="+gameObject.name+"target");
    I get a new game object....
    if I load with this:
    Code (csharp):
    1.  ES2.Load<Transform>("save.sav?tag="+gameObject.name+"target", target);
    it still does not change that variable.....

    am I doing something wrong?

    Thank You!
     
  33. nia1701

    nia1701

    Joined:
    Jun 8, 2012
    Posts:
    74
    Ah I figured out my mistake! Sorry for the confusion.

    What I really should be saving is the transform.name to a string....

    THEN load that string back into a GameObject.Find(loadstringcodehere).transform
    That way it keeps the reference (right term?) to the gameobject I was trying to reference the transform FROM.

    GREAT product!
     
  34. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
    I cannot build my project, here's the log:

    If I comment the two script I can build my project but here's what xcode tell me:

     
    Last edited: Jul 25, 2012
  35. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi there,

    Try putting the Easy Save folder into a folder named 'Standard Assets'. Also make sure that ES2AutoInspector.cs and ES2DefaultSettingsInspector.cs are in a folder named 'Editor' inside the Easy Save folder.

    All the best,
    Joel
     
  36. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Is it possible to save to Memory instead of File ?
     
  37. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi yuewahchan,

    Saving using the default PlayerPrefs mode saves to memory, and then saves to disk when the application quits. Hope this helps!

    All the best,
    Joel
     
  38. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Hi Joel!

    I'm considering Easy Save for my project, but then found this on your site's faq: "For security reasons, you cannot directly access save files on iOS, Android, Flash or Web Player."

    I need to save data to file on the iPad, and then retrieve the file from my Mac. Not possible? If not, why not save to iOS document's folder?

    Would definitely buy if file IO works on iOS.

    Cheers,

    G
     
    Last edited: Aug 4, 2012
  39. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi gregzo,

    We have to add this disclaimer because we cannot guarantee that the main Documents folder will be writable, depending on the security settings of the user. Apps which allow you to access save files usually have a secondary app installed on the Mac to allow access, but this is well outside the realm of Easy Save I'm afraid.

    All the best,
    Joel
     
  40. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    I was thinking of Using iPhone explorer to retrieve the file. The user is me (the goal is to modify lots of settings/presets while testing the app, save that to file, retrieve and include in resources), so I guess I'm good to go? Had a look in iOS 5.1 settings, couldn't find what option denies read/write access to /documents...
     
  41. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    I can see nothing wrong with doing this, but again, we can't provide any guarantee that it will work. However, if it doesn't work, we'd be happy to arrange a refund.

    All the best,
    Joel
     
  42. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Thanks a lot for the super quick replies and the refund proposal.

    One last question: browsing your documentation, I couldn't find anything about loading from Resources. Is it possible directly, or should one use a workaround(Resources.Load text asset generated by ES2, ES2.SaveRaw to file, load tagged data from file with ES2)?

    Last question, promised!
     
  43. fanjules

    fanjules

    Joined:
    Nov 9, 2011
    Posts:
    167
    I found myself using EasySave recently for GPS data logging and wanted to retrieve the files on Android/iOS back to my PC. I couldn't find any easy method to do this (even Android appears not to offer access to the file system without rooting??)... so in the end used the unity web component to post the data back to my server. I don't use PHP so wrote my own code, but I recall EasySave allows posting to a website operating PHP.
     
  44. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Hummm... I thought Application.persistentDataPath allowed write access, retrievable by iExplorer. Is that not the case? Will test myself, but would be glad to save some time if someone can confirm it works/doesn't.

    Cheers!

    Gregzo
     
  45. fanjules

    fanjules

    Joined:
    Nov 9, 2011
    Posts:
    167
    To be fair I'm unsure as I'm quite new to Android/iOS.

    Thinking about it... it's a shame Unity doesn't allow some kind of access to the file system from within the EDITOR (limiting access to just the apps test files). That doesn't sound too hard to implement... the dev build of the Android/iOS app would have the relevant functions included for it to connect back to the editor. The important thing is that it would be cross platform and remove the need for us to research other ways to do it on each platform. Just thinking aloud!
     
  46. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Using SaveRaw is the right way to go. We demoed a LoadFromResources method but it caused a surprising amount of confusion, so unfortunately we had to deprecate it.

    Regards,
    Joel
     
  47. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    @fanjules

    Application.persistentDataPath will give you the path you can write to on mobile devices as well. Simpy add iTunesFileSharing true in Info.plist, and of you go! No need to retrieve with iTunes, iExplorer does the job neatly too. Just tested with System.IO.FileStream, no problem writing or reading.

    @joeltebett
    Thanks a bunch for the replies, you got yourself a customer. It's a shame you had to pull the LoadFromResources method, would have been very handy in my case. Will write my own, but it does seem quite contrived to have to write the file to disk before loading it...

    Cheers,

    Gregzo
     
  48. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    For the default PlayerPrefs mode, Is it using the unity PlayerPrefs class ? if yes, it is still very slow on mobile device.
     
  49. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Bought, tested, setup a SaveLoad manager for a script I needed to serialize (a bunch of vars of different types) - took me a couple of hours. Working fine, saving on iOS and retrieving to include in build, etc... Great tool.

    Two complaints :
    -1)Docs could be a little clearer (more examples, more detailed examples, list all methods in one place). It's not evident what you can and can't do : took some searching to find Lists could be appended and loaded with LoadAllList, for example. ES2Settings properties could be all listed. A bit of needless trial and error that could be avoided with just a bit more details in the docs!

    -2) Real bummer you pulled that LoadFromResources method.

    That aside, huge time saver!

    Cheers,

    Gregzo
     
  50. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi there,
    It does use the PlayerPrefs class, though we've not had complaints about speed in the past. Serializing data is inherently slow, so if you're saving a large amount of data then it may be a compromise you have to make.