Search Unity

Easy Save - The Complete Save & Load Asset for Unity

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

  1. profanicus

    profanicus

    Joined:
    Nov 23, 2009
    Posts:
    286
    My stuff is heavily component based so I tend to have more than one component on an object that needs to save itself when receiving an event, hence I can't use the object name. I do try to keep my names unique.

    I guess I could get the name of the component and append that to the object name, sounds like the easiest way assuming it works.
     
  2. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    This is actually the method that we use with the ES2 Autosaver, so I would definitely recommend it.
     
  3. petrucio

    petrucio

    Joined:
    Aug 30, 2011
    Posts:
    126
    I like the product, but I just want to give my feedback here that finding documentation is a real pain. The site is all over the place and completely broken, even links posted in this thread (like http://www.moodkie.com/easysave/docs.php), are 404.

    A big html reference file inside the unity package would also come in handy.

    I bought ES2 to save me time, but it's sucking it up some.
     
  4. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Hi Petrucio,

    Sorry for the inconvenience. The current documentation system is something which we quickly made as a temporary measure while ES2 is in beta. Some links earlier in this thread will be out of date because they are for Easy Save 1. All documentation can be found at http://www.moodkie.com/easysave, including the original Easy Save 1 docs.

    Thanks,
    Joel
     
  5. Rolands

    Rolands

    Joined:
    Aug 15, 2010
    Posts:
    90
    i like this product very much, saved me lots of time. just wanted to ad that material type support wold be nice too, if it is posible.
     
  6. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Thanks for the praise. I'll add the Material type to our To Do list for you.

    All the best,
    Joel
     
  7. bvanasse

    bvanasse

    Joined:
    Apr 16, 2012
    Posts:
    1
    I have a question regarding the usability of ES2 over the web. I have followed the instructions at "http://www.moodkie.com/easysave/Web.php", but I haven't been able to get anything into mySQL. Now, I've had zero problems saving to a local file - kudos btw - but when I change the save path to point at my Apache server(s), I can't get it to throw any kind of exception. It looks like it doesn't even attempt to open a connection.

    - I've tried both the Javascript and C# examples in a brand new project.
    - I've tried to catch exceptions in a coroutine per the examples, then without exceptions and without the coroutine. Both techniques did not work.
    - I stripped down and modified the example PHP script to log attempted connections from any source, but nothing seemed to be logged except my tests from the browser.

    I'm particularly puzzled at why I'm not receiving any kind of response from IsUploadError or GetUploadError, even when I feed it a garbage URL. I really hope I'm not missing something obvious, but I've read everything that seemed pertinent in both this thread and the web documentation.

    Any insight would be nice. Keep up the good work!
     
  8. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Hi bvanasse,

    Are you making sure that you put 'http://' at the beginning of the URL? If this isn't the problem, could you send me the code you are using at moodkie.com/contact and I'll see if I can find a solution for you.

    Regards,
    Joel
     
    Last edited: Jun 1, 2017
  9. smwdtr

    smwdtr

    Joined:
    Apr 18, 2012
    Posts:
    9
    Hi there. I am trying to get your web save functionality running, but have run into a few problems. I tried following your documentation for easy save 1, but when it tells me to edit EasySave.cs to update my file paths/passwords, I am unable to locate it.
    Also, when using easy save 2, when adding autosaves to gameobjects or adding the default settings object I get an error:

    Instance of ES2AutoInspector couldn't be created because there is no script with that name.

    In addition, when I try and run your test scene it tells me that easy save tester and autotester are missing their behaviours. Clearly I am missing something, and some help would be appreciated.

    Cheers
     
  10. Rolands

    Rolands

    Joined:
    Aug 15, 2010
    Posts:
    90
    Move scripts ES2DefaultSettingsInspector and ES2AutoInspector to editor folder in project it will fix this problem
     
  11. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Hi smwdtr,

    I'm about to submit an update which addresses this problem. We converted ES1 to use libraries instead of the EasySave.cs file, but completely forgot that it would need to be edited for Web functionality. Alternatively there are the ES2 Web methods, which work in a similar way.

    Also if Rolands method doesn't fix your other problem (thanks Rolands!), try deleting Easy Save and reinstalling it. It could be that some files have been deleted, or the Asset Store forgot to install them.

    Thanks,
    Joel
     
  12. smwdtr

    smwdtr

    Joined:
    Apr 18, 2012
    Posts:
    9
    I tried usings Rolands method, but still gives me the error. Re-installing didn't seem to get me anywhere either.

    I guess the best option is to wait for you to release that update? Do you have any idea when you guys will have it out?
     
  13. smwdtr

    smwdtr

    Joined:
    Apr 18, 2012
    Posts:
    9
    OK, got rid of the errors, now to ask the real questions!

    In your instructions, it says that...

    "Make a copy of the ES2PHP.php file provided with Easy Save 2 and fill in your MySQL and Unity details."

    Can someone give me an example of what the php file should look like? My game only needs to save a few variables. For instance, lets say I wanted to save an int variable called health.

    Sorry I have only been coding for a few months and have zero MySQL experience. Any help would be much appreciated!:)
     
  14. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Hi smwdtr,

    The MySQL details would be the details provided for you by your webspace provider for your database; get in touch with them if you're not sure what these are. The file currently contains example MySQL details at the top which you need to replace with your own details. If you're using the supplied SQL table, you won't need to change tableName, dataFieldName, idFieldName and tagFieldName.

    Hope this helps!
    Joel
     
  15. Rolands

    Rolands

    Joined:
    Aug 15, 2010
    Posts:
    90
    i need a bit of help, so i am trying to save and load texture of material. i do like this -->

    public GameObject kubs;
    ES2.Save( kubs.renderer.material.mainTexture, "myFile.txt?tag=myTextura" );
    kubs.renderer.material.mainTexture = ES2.Load<Texture2D>( "myFile.txt?tag=myTexture");

    i have no problems saving and loading colors and other stuf but this dosent work for me. what am i doing wrong?

    and haw do i save prefrabs corect? i do like this -->ES2.Save(find_josla_922.transform.position, "myFile.txt?tag=myPosition_prefabs");

    find_josla_922.transform.position = ES2.Load<Vector3>( "myFile.txt?tag=myPosition_prefabs" );
     
    Last edited: Apr 19, 2012
  16. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Hi Rolands,

    When saving in your first example there is a spelling mistake (myTextura should be myTexture).

    Also you can't save an entire prefab because it's far too large, but you can save certain features of that prefab. If you just want to save the position, your example will work fine.

    Any other questions, please let me know.
    Joel
     
  17. Rolands

    Rolands

    Joined:
    Aug 15, 2010
    Posts:
    90
    ah that was such a stupit mistake

    yee i was looking for position but it dosent seam to work, i see some info in file i save, but it dosent seam to load up, i just dont know someting is not right
     
  18. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    If you email me the script with your code in, I'll see if I can work out the problem: moodkie.com/contact.

    Regards,
    Joel
     
    Last edited: Jun 1, 2017
  19. giza

    giza

    Joined:
    May 4, 2008
    Posts:
    69
    Hi joeltebbett,

    I've been integrating Easy Save into my app. I'm getting an out of range error with the the following code:

    Code (csharp):
    1. var objects : GameObject[];
    2. var ts : Transform[];
    3. var names : String[];
    4. var i : int;
    5. var i2 : int;
    6. var go : Object;
    7. var tex : Texture2D[];
    8.  
    9. function OnGUI () {
    10.  
    11.     if(GUI.Button (Rect(100,30,50,50), "Save")){
    12.     print ("you hit save");
    13.     objects = GameObject.FindGameObjectsWithTag("Player");
    14.     SaveName();
    15.     }
    16.    
    17.     if(GUI.Button (Rect(150,30,50,50), "Load")){
    18.     print ("you hit load");
    19.     instantiateObjects();
    20.         }
    21. }
    22.  
    23. function SaveName()
    24. {
    25.         ts = new Transform[objects.Length];
    26.         names = new String[objects.Length];
    27.         tex = new Texture2D[objects.Length];
    28.    
    29.         for(i=0;i<objects.Length; i++)
    30.         {
    31.             ts[i] = objects[i].transform;
    32.             names[i] = objects[i].name;
    33.             Debug.Log (names[i]);
    34.             tex[i] = objects[i].renderer.material.mainTexture; 
    35.         }
    36.         ES2.Save(ts,"transforms.txt");
    37.         ES2.Save(names,"names.txt");
    38.         ES2.Save(tex, "tex.txt");                  
    39. }
    40.  
    41. function instantiateObjects()
    42.     {
    43.         names = ES2.LoadArray.<String>("names.txt");       
    44.         objects = new GameObject[names.Length];
    45.         for(i2=0;i2<names.Length;i2++)
    46.                 {
    47.                     objects[i2] = Instantiate(UnityEngine.Resources.Load(names[i2],GameObject)) as GameObject; //Load
    48.                 }
    49.                     ES2.LoadArray.<Texture2D>("tex.txt");
    50.                     ES2.LoadArray.<Transform>( "transforms.txt", ts);
    51.         }
    The last line of code generates an IndexOutOfRangeException?
     
  20. uzzy

    uzzy

    Joined:
    Sep 8, 2010
    Posts:
    2
    Really liking Easy Save 2 so far. It seems to fit my needs just about perfectly. Good work!

    I have a bug to report, though. (Or I'm misunderstanding something.) On Windows, ES2 is prepending "C:\" to my full paths. Problem is, those paths are already prefixed with "C:\". So, if I make a call like

    Code (csharp):
    1. string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MyGame");
    2. string saveFilePath = Path.Combine(appDataPath, "savegame.es2");
    3. if (!Directory.Exists(appDataPath))
    4.   Directory.CreateDirectory(appDataPath);
    5. ES2.Save(obj, saveFilePath+"?savelocation=file&savemode=overwrite&tag=someTag"));
    I get an error like this:

    PHP:
    DirectoryNotFoundExceptionCould not find a part of the path "C:\C:\Users\nobody\AppData\Roaming\MyGame\savefile.txt".
    System.IO.FileStream..ctor (System.String pathFileMode modeFileAccess accessFileShare shareInt32 bufferSizeBoolean anonymousFileOptions options)
    System.IO.FileStream..ctor (System.String pathFileMode mode)
    (
    wrapper remoting-invoke-with-checkSystem.IO.FileStream:.ctor (string,System.IO.FileMode)
    MoodkieFileWriter.CreateFileStream ()
    MoodkieFileWriter.Save ()
    MoodkieSave.Save (System.Object param, .ES2Settings settings)
    ES2.Save (System.Object paramSystem.String identifier)
    ...
    Any suggestions?
     
  21. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Hi Giza, I've made a couple of small modifications to your code which makes it work at our end.

    Firstly, I changed the line:
    Code (csharp):
    1. tex[i] = objects[i].renderer.material.mainTexture;
    to:
    Code (csharp):
    1. tex[i] = objects[i].renderer.material.mainTexture as Texture2D;
    because mainTexture is a Texture by default, not a Texture2D.

    Secondly, I added another line of code in the loop in instantiateObjects:
    Code (csharp):
    1. for(i2=0;i2<names.Length;i2++)
    2. {
    3.     objects[i2] = Instantiate(UnityEngine.Resources.Load(names[i2],GameObject)) as GameObject; //Load
    4.     objects[i2].name = names[i2]; // New line of code
    5. }
    Because when you instantiate it adds "(Clone)" to the end of the name, so you want the name to match the name you specified in Resources.

    I think you're going to run into a few problems with your code. For example, pressing Load will not work unless the user presses Save first because the Transform array doesn't exist until the user presses Save. You might also want to check that there is any save data to load by using:
    Code (csharp):
    1. if(!ES2.Exists("names.txt"))
    2.             return;
    And you might also want to delete old objects before Loading, otherwise you will have lots of duplicates. This could be done with something like:
    Code (csharp):
    1.  
    2. objects = GameObject.FindGameObjectsWithTag("Player");
    3. var i3 : int;
    4. for(i3=0; i3<objects.Length; i3++)
    5. {
    6.     Destroy(objects[i3]);
    7. }
    But if the number of Player objects is always the same, you might not need to instantiate new objects at all as you could reuse the old objects and just update their positions etc. Solving problems like these is why coding can be so interesting :)
     
  22. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Hi uzzy,

    Thanks for your post. I'm looking into this at the moment so I should hopefully have a solution for you soon.

    Regards,
    Joel
     
  23. matis1989

    matis1989

    Joined:
    Mar 23, 2011
    Posts:
    162
    Hi,
    I want to ask is possible save string and float into one file? If yes how achieve this? I have markers on map with specific name and specific location. I think best solution is save "list" of these object like: Name: "..." Position: "..."
    I hope you understand me.:)
    Thank you for answer.

    EDIT: I find something about tags.
     
    Last edited: Apr 23, 2012
  24. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Good news uzzy. I've just submitted an update to the Asset Store to solve this problem, so hopefully it will be live soon.

    All the best,
    Joel
     
  25. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Hi matis,

    Glad to see you found the documentation about tags. For anyone else who wants to know how to save multiple things to a file using tags, here's an example:

    Code (csharp):
    1. // Save an integer to a file called myFile.txt.
    2. // And give it a unique tag which we can use to load it.
    3. ES2.Save(128, "myFile.txt?tag=myIntegerTag");
    4.  
    5. // Now lets save the position of an object to the same file.
    6. // Using a different unique tag.
    7. ES2.Save(transform.position, "myFile.txt?tag=myPositionTag");
    8.  
    9. // And then to load each of these separately ...
    10. int myNewInt = ES2.Load<int>("myFile.txt?tag=myIntegerTag");
    11. transform.position = ES2.Load<Vector3>("myFile.txt?tag=myPositionTag");
    12.  
     
  26. giza

    giza

    Joined:
    May 4, 2008
    Posts:
    69
    Thanks very much joeltebbett! That's great!
     
  27. giza

    giza

    Joined:
    May 4, 2008
    Posts:
    69
    I've just tested the code with your changes and there is clearly something I'm still missing! Only one set of transforms is being saved even though I add multiple objects to my scene. I've tested this by adding a control array variable called transformTest and then debugging again:

    Code (csharp):
    1. names = ES2.LoadArray.<String>("names.txt");        
    2.     var transformTest : Transform[] = EasySave.loadTransformArray("transforms.txt");
    3.     Debug.Log (transformTest.Length);
    4.     Debug.Log (names.Length);
    The length of transformTest is always just 1 regardless of how many objects there are in the scene that are placed at different coordinates. So only one set of transforms is saved to transforms.txt even though Easy Save populates the scene with all of the saved objects. Sorry, I'm obviously missing something very basic here!
     
  28. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    In your example you are mixing Easy Save 2 functions with Easy Save 1 functions; this won't work.
    In Easy Save 2, you cannot load Transforms into an array because a Transform cannot exist without a GameObject, so it would also have to leak unwanted GameObjects into the scene.

    In your original example you were using this self-assigning function:
    Code (csharp):
    1. ES2.LoadArray.<Transform>( "transforms.txt", ts);
    This is the right way to do it. Hope this all makes sense.
     
  29. xindexer

    xindexer

    Joined:
    Dec 29, 2011
    Posts:
    9
    I need to be able to export a file from within a web player. What I'd like to be able to do is to have the user click on the "Export" button and have a save as dialog box popup giving them the ability select a location for the file.

    Can this be done with ES2? can it be done in Unity? My other option will be to call a external JS function but wanted to see if ES2 can do something like this.

    Thanks

    EDIT: Figured it out using Application.ExternalCall()

    Here's what I did for those who come across this later...

    Application.ExternalCall("javascript function name", var1,var2,var3);

    in the parent HTML page:

    Code (csharp):
    1.  
    2. <script type="text/javascript">
    3. function getFile(var1,var2,var3) {
    4.     $('#var1').val(var1);
    5.     $('#var2').val(var2);
    6.     $('#var3').val(var3);
    7.   $('#getFile').submit();
    8. }
    9. </script>
    10. <form method="post" action="(link to PHP script)" id="getFile">
    11.     <input type="hidden" id="var1" name="var1">
    12.     <input type="hidden" id="var2" name="var2">
    13.     <input type="hidden" id="var3" name="var3">
    14. </form>
    15.  
    And in your PHP file:

    PHP:
    $output = (data from MYSQL query - use "\n" as a divider) - i.eimplode("\n",$mysqlColumn);
    $filename "some file name';
    $fh = fopen('tmp/'.$filename,'w') or die("Error Can't open file");
    fwrite($fh,$output);
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Disposition: attachment; filename=$filename");
    header("Content-Type: application/zip");
    header("Content-Transfer-Encoding: binary");
    readfile('
    tmp/'.$filename);
    Haven't checked this in all browsers yet but works in FF
     
    Last edited: Apr 24, 2012
  30. giza

    giza

    Joined:
    May 4, 2008
    Posts:
    69
    Ok thanks! I got it, it's working fine now!
     
  31. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Hi Xindexer,

    There is no built in functionality to achieve this, but there is a (currently undocumented) LoadRaw function in Easy Save 2 which returns a file as a byte array. You could use this byte array as a parameter in Unity's Application.ExternalCall() method to communicate with a Javascript method on the same web page as the Web Player. You could then use something like this plugin to create a save dialog: http://www.ardentedge.com/pr_fd.htm. I've never done this myself so I cannot guarantee that this would work. You are very limited when saving via the web due to security restrictions.

    A second alternative would be to convert the byte array to a Base64 string and then send this to a PHP script on your server as a POST paramater using Unity's WWW function. This PHP file could then be made to email the data as a file attachment. There are various methods to create a file attachment from a Base64 string, but the easiest seems to be the PEAR Mail_Mine::addAttachment() method.

    The third way would be to use Easy Save's Web functionality to save the data to a database on your server. Instead of requiring the end user to save a file, you could instead link each piece of saved data in the database with a username or a unique code which the user has to enter into your Web Player to load the data. You could even link it with a PHP script to email the unique ID to the user; this is what we did in one of our apps which was cross-compatible between iPhone and Web Player.

    There are other ways, but they're generally variations of the former. And even more generally, saving to the users hard disk over the web isn't easy, even if you're not using Unity. Hope this helps!

    All the best,
    Joel
     
  32. Rolands

    Rolands

    Joined:
    Aug 15, 2010
    Posts:
    90
    hi joel
    i was looking at this ES2.SaveRaw . i need a bit of help understanding haw it works. so as far i understand this-->
    public IEnumerator SaveWebsiteToFile(string url)
    {
    WWW www = new WWW(url);
    yield return www; // Wait for website to download
    ES2.SaveRaw(www.bytes, "myFolder/myWebsite.txt?savelocation=file");

    }
    can get some date from web, or maybe html fail like this one http://pastehtml.com/view/bvxh5cq3d.html
    so lets say i save some date put them in web like text file or maybe other format.
    how do i use thies date(if it even works like that) to get my info from file back? LoadRaw??
    i save date like this -->ES2.Save(kubs.transform.position,tags+ ".html?tag=myPosition_kubs"); put this in web like .html
    haw do i load it? can i load it? does it work in standalone or only webplayer?


    p.s sory for my english skills and i am noob :D
     
    Last edited: Apr 25, 2012
  33. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Put simply, SaveRaw takes an array of bytes and saves it to a file without modifying the bytes or adding header data. For example, if you were using this method to load from web:
    Code (csharp):
    1. public IEnumerator SaveWebsiteToFile(string url)
    2. {
    3.     // Load raw data from your webspace.
    4.     WWW www = new WWW(url);
    5.     yield return www; // Wait for website to download
    6.     // Save this data.
    7.     ES2.SaveRaw(www.bytes, tags+ ".html);
    8. }
    Then you can load your data using:
    Code (csharp):
    1. ES2.Load<Vector3>(tags+ ".html?tag=myPosition_kubs");
    We've currently not documented LoadRaw as the method name might change to GetRaw before the main release.

    Don't worry about your English, I had no trouble understanding you :)
     
  34. smwdtr

    smwdtr

    Joined:
    Apr 18, 2012
    Posts:
    9
    I have the sql database set up now, and I am trying to use the example coroutine given in the tutorial. When it runs, I get this error:

    True
    UnityEngine.Debug:LogError(Object)
    $:MoveNext() (at Assets/Scripts/PlayerStats/PlayerStats.js:1354)

    I also seem to get this one as well:

    ES2WebException: ES2 Web Exception: ERROR: Couldnt access database with these credentials....b00acbee4fd90dfc3f97eb9cf9af9398
    MoodkieRoutine+<uploadRoutine>c__Iterator1.MoveNext ()

    What does this mean?

    I gather that the webexception is caused by the unity webUsername and webPassword. Where should these be set?
     
    Last edited: Apr 26, 2012
  35. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Hi smwdtr,
    This signifies that there is an error in your code, in your PlayerStats.js file at line 1354, or you are making a call to Debug.LogError() at that line.

    Firstly, the username and password need to be set in the PHP file. Then the same username and password can be specified in Unity using one of two methods:

    1) Go to the Easy Save menu item and select 'Add Default Settings Object to Scene'. Then you can change the Default Web Password and Default Web Username for this scene using this object.

    2) Or you can specify webusername and webpassword as parameters like this:
    Code (csharp):
    1. ES2.Save(myData, "http://www.mysite.com/myData.php?webusername=MyUsername&webpassword=MyPassword");
    All the best,
    Joel
     
    Last edited: Apr 26, 2012
  36. smwdtr

    smwdtr

    Joined:
    Apr 18, 2012
    Posts:
    9
    Thanks Joel That got me past that hurdle. My next error I get is:


    ES2WebException: ES2 Web Exception: <br />
    <b>Warning</b>: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'bowen_bowen'@'rezzo.websitewelcome.com' (using password: YES) in <b>/home/bowen/public_html/ES2PHP.php</b> on line <b>54</b><br />
    ERROR: Cant connect into database.
    MoodkieRoutine+<uploadRoutine>c__Iterator1.MoveNext ()

    the username for my sqldatabase should be bowen_bowen, but I'm not sure where the @rezzo stuff is coming from. I am managing my database through the websites cpanel.
     
  37. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    The @rezzo part will be added by your server during the authentication process. I can't help you much with this because details vary between webspace providers. The best idea is to contact your webspace provider and explain that you are having trouble connecting to the database via PHP using those login details. They should be able to give you the correct login details.

    Regards,
    Joel
     
  38. smwdtr

    smwdtr

    Joined:
    Apr 18, 2012
    Posts:
    9
    Thanks for the advice Joel. I found a tutorial on my hosting website (hostgator), and found that they require the mysql host name in the PHP file to be"localhost". (maybe you want to add that as a suggestion in the comment in the php file?)

    Everything seems to be working now, thanks for the support!
     
  39. smwdtr

    smwdtr

    Joined:
    Apr 18, 2012
    Posts:
    9
    Warning!: incoming noob question lol

    I am trying to use the load coroutine example but I am getting this error:


    Assets/Scripts/PlayerStats/PlayerStats.js(1404,35): BCE0018: The name 'string' does not denote a valid type ('not found'). Did you mean 'System.Runtime.CompilerServices.StrongBox'?

    I'm getting it from this line:

    var myString : String = ES2.Load.<string>(myURL);

    I assume I have to replace the <string> with something else, but I don't have much experience with these.
     
  40. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    You are correct. In JavaScript, it is String with an uppercase S.
     
  41. bigSky

    bigSky

    Joined:
    Jan 31, 2011
    Posts:
    113
    Great looking product. Can I save animation curves generated at runtime with Easy Save?
     
  42. smwdtr

    smwdtr

    Joined:
    Apr 18, 2012
    Posts:
    9
    I seem to have found another problem. I can run the game with no problem from the editor, but when I do a build and run it through the web browser, the load and save coroutines seem to hang after ES2.Download runs. I am not sure what the issue is, as I don't have the debugger when its published. Is there a way to print the errors if any into a gui button or something that I can see? Do you have any ideas what might have changed when it gets built?


    I found this in my webplayer log:

    Platform assembly: C:\Users\Bo\AppData\LocalLow\Unity\WebPlayer\player\3.x.x\Data\lib\CrossDomainPolicyParser.dll (this message is harmless)
    ES2WebException: ES2 Web Exception: Rejected because no crossdomain.xml policy file was found
    at MoodkieRoutine+<LoadRoutine>c__Iterator2.MoveNext () [0x00000] in <filename unknown>:0

    Any ideas?
     
    Last edited: Apr 28, 2012
  43. smwdtr

    smwdtr

    Joined:
    Apr 18, 2012
    Posts:
    9
  44. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Thanks BigSky. Easy Save can't currently save animation curves, but it's on our to do list.
     
  45. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    That is correct. Before developing for Web Player it's always worth reading Unity's Security Guide. You can also emulate the security in the editor by going to Edit->Project Settings->Editor and selecting "Emulate Web Security".
     
  46. uzzy

    uzzy

    Joined:
    Sep 8, 2010
    Posts:
    2
    I'm a bit late in replying, especially considering how quickly you fixed the issue, but thanks so much!
     
  47. WarbladerToo

    WarbladerToo

    Joined:
    Nov 2, 2009
    Posts:
    96
    Hi! I'm a bit new to Unity and got the easy save plug in the other day for my learing project. But I got an error with ES2.


    Assets/Standard Assets/Easy Save/Easy Save 2 Beta/Editor/ES2AutoInspector.cs(2,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?

    What could be wrong?
     
  48. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    522
    Thanks for your message Warblader,

    Try dragging the Easy Save folder so that it is outside of Standard Assets. It should no longer be necessary to put the Easy Save folder into the Standard Assets folder to use it with Javascript.

    All the best,
    Joel
     
  49. Memory-Noise

    Memory-Noise

    Joined:
    Jan 17, 2011
    Posts:
    16
    Hi, probably it's just a stupid error on my part, but ES2.Exists keeps returning False no matter which path I try. Any idea? I'm using it inside a EditorWindow class, on Lion 10.7.3 / Unity 3.5.
    By the way, ES2.save works correctly, but I cannot load any file (if I don't check them before with ES2.Exists, it just throws an "EndOfStreamException: Failed to read past end of stream." error.
     
  50. matis1989

    matis1989

    Joined:
    Mar 23, 2011
    Posts:
    162
    hi, Iam trying rewrite my ES1 script to ES2 but I have one error.
    My code for save is:
    Code (csharp):
    1. void SaveGrass()
    2. {
    3. GameObject[] grass = new GameObject[0];
    4. grass = GameObject.FindGameObjectsWithTag("grass");
    5. Transform[] gs = new Transform[grass.Length];
    6.    for(int i=0;i<grass.Length; i++)
    7.    {
    8.       gs[i] = grass[i].transform;
    9.    }
    10.     ES2.Save (gs ,  "Save.txt?tag=grass" );
    11.  
    12.     }
    and my load script is:
    Code (csharp):
    1. grass_prefab = ES2.Load <GameObject> ("Save.txt?tag=grass");
    After I try load I have this error:
    ES2WrongTypeException: Easy Save Wrong Type Exception: Expected System.Type, but found UnityEngine.Transform.
    MoodkieReader.ReadHeader (Byte expectedType, Byte expectedArray)
    MoodkieReader.ReadHeader (.Keys[] keys)
    MoodkieLoad.Load[GameObject] (.ES2Settings settings)
    ES2.Load[GameObject] (System.String identifier)

    what is wrong? Thanks a lot