ES2 release upgrade: The Good, The Badass, and The Ugly

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
petrucio
Posts: 3
Joined: Fri Jan 25, 2013 1:19 am

ES2 release upgrade: The Good, The Badass, and The Ugly

Post by petrucio »

The Good: Upgrade was painless, and solved the bug I posted on the old thread that I had with some of my paths.
The Badass: Saving and loading AudioClips is working nice and easy (yaaaaaayy!)
The Ugly: Each call to ES2.Save(value, path?tag) is erasing the save file and saving on top of it, I end up only with the last value saved. (What the, holy-frack, WHAT????)

Am I doing something wrong? Is there any setting I should set before saving to avoid the file resetting?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES2 release upgrade: The Good, The Badass, and The Ugly

Post by Joel »

Hi Petrucio,

I'm looking into this for you at the moment. It looks like something odd is happening when we compile to our DLL.

All the best,
Joel
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES2 release upgrade: The Good, The Badass, and The Ugly

Post by Joel »

Solved!

For some reason, when compiling the DLL, one of the precompiler directives was being ignored. We've found another way around it and I'll get an update sent out today.

Thanks for making us aware of this; we'll be running our unit tests before and after compilation from now on!
petrucio
Posts: 3
Joined: Fri Jan 25, 2013 1:19 am

Re: ES2 release upgrade: The Good, The Badass, and The Ugly

Post by petrucio »

Thanks! Any chance I can get that dll before the update clears on Unity?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES2 release upgrade: The Good, The Badass, and The Ugly

Post by Joel »

You have mail :)
petrucio
Posts: 3
Joined: Fri Jan 25, 2013 1:19 am

Re: ES2 release upgrade: The Good, The Badass, and The Ugly

Post by petrucio »

All good, thanks - Woohoo!

I'm making a build of our Cutscene Creator today now that it has everything it needs, starting an internal contest, and hopefully I'll be posting a bunch of videos featuring it (and ES2, indirectly) here in about two weeks :)
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES2 release upgrade: The Good, The Badass, and The Ugly

Post by Joel »

Great news, we look forward to seeing them!
trothmaster
Posts: 5
Joined: Tue Jan 22, 2013 4:02 am

Re: ES2 release upgrade: The Good, The Badass, and The Ugly

Post by trothmaster »

Hi Joel,
I had been using the beta just fine but wanted to give this new release a chance. I've had to manually set the default save location to file even though the docs say it is set there by default (unless I miss-read them?)

-I now have to check if a file exists and then delete it before writing over that file, in the beta it seemed to just overwrite the file automatically.

-I'm getting some kind of strange bug happening that is causing the game to write hundreds of megs of data to a file and freeze unity. I can't quite figure out why thats happening. Are there telltale signs I can look out for?
I didn't change any of my code which was working with the beta. Again, i'm not saying i can't go back to the beta but I'd love to stick with the latest release. It does this when I'm saving many objects (maybe 100) and all kinds of types. If i just save a few objects it seems fine....
Here is how I setup the directory to save to:

Code: Select all

void SetupDirectories(){
		ES2GlobalSettings.defaultSaveLocation = ES2.SaveLocation.File;
		
		//MAC
		if(Application.platform == RuntimePlatform.OSXPlayer){
			string dir = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
	
			dir = dir.Replace("/Documents", "/Library/Application Support/[I]<app-identifier>[/I]/");
	
			if(!Directory.Exists(dir)) {
	
	  	  		Directory.CreateDirectory(dir);
	
			}
			
			ES2GlobalSettings.defaultMacDataPath = dir;
			_saveDirectory = dir;
		}
		
		//PC
		else if(Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor){
			//get the users data path
			string dir = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
			//change the string to the Saved Games\Bik directory
			dir = dir.Replace("\\Documents","\\Saved Games\\Bik");
			//if the directory for bik doesn't exist, create it
			if(!File.Exists(dir)) Directory.CreateDirectory(dir);
			//change easy save pc save path directory
			ES2GlobalSettings.defaultPcDataPath = dir;
			_saveDirectory = dir;
			//print (dir);
		}
		//any other platform
		else {
			_saveDirectory = Application.persistentDataPath;	
		}
	}
And here is my save method:

Code: Select all

public void Save (){
		//check if the file exists and delete it because its going to get created again
		if(ES2.Exists(saveFile)) ES2.Delete(saveFile);
		
		//Global Variables Holder
		GlobalVariablesHolder.Instance.SaveGlobalVars();
		
		//Save current Scene State
		//AO.controlcenter.SendMessage("SaveSceneState");
		AO.controlcenter.GetComponent<SceneStatesController>().SaveSceneState();
		
		//Registered Objects
		if (SaveEarly != null) SaveEarly();
		if (SaveLate != null) SaveLate();
		if (SaveRealLate != null) SaveRealLate();
		
		//Current Level
		ES2.Save(Application.loadedLevelName, saveFile+"?tag=CurrentLevel");
		
		//Inventory
		ES2.Save(AO.inventory.GetComponent<Inventory>().inventory, saveFile+"?tag=inventory");
		
		//Timer
		ES2.Save(timer, saveFile+"?tag=timer");
		
		//MouseTarget
		ES2.Save(AO.mouseTarget.transform.position, saveFile+"?tag=mouseTarget");
		
		Debug.Log("saved");
	}


Thanks!
trothmaster
Posts: 5
Joined: Tue Jan 22, 2013 4:02 am

Re: ES2 release upgrade: The Good, The Badass, and The Ugly

Post by trothmaster »

Just an update,
it seems it was going into a loop caused by the way I was naming the save tag. For example I would name a tag like this:
"?tag="+gameObject.name+"transformPos";

so what I did was change it to this:
"?tag="+gameObject.name+GetInstanceID().ToString()+"transformPos"

and now it doesn't cause the loop....

Am I using it wrong to cause this to happen?

Thanks!
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES2 release upgrade: The Good, The Badass, and The Ugly

Post by Joel »

Hi trothmaster,

There's nothing that you are doing wrong. It would seem that something at our end didn't like the changes we made to fix the overwrite bug.

We're looking into this and will hopefully have an update submitted later today. I think this is most likely a problem which can be solved by using Visual Studio to create the DLL rather than MonoDevelop, which seems to be getting confused over conditional compilation.

I'll get back to you as soon as we have more news!

Thanks,
Joel
Locked