How to… get started ?

This is the place to find out how to accomplish something specific with EZ Game Saver.

How to… get started ?

Postby lasco » Sun Sep 25, 2011 3:08 pm

Running Unity 3.4.0f5 - Mac OSX

Hi,

Sorry for newb questions here but I did not found the answers I need in past threads of this forum.

I bought / installed EZ Game Saver and started to experiment. As I'm very low experimented in code (especially C#) I followed the manual step by step to make it work. But it does not and I wonder what I'm doing wrong, adding that I'm not sure I understand everything in the doc.

I got a "wall" of square tiles I can rotate one by one just clicking on them. They rotate on Z axis and this produces different pattern effects. I need to save different combination/mixes. So the only setting I need to save for the moment is rotation.

(see sample here if needed : http://www.chantiergraphique.com/CCARRE)


Now the list of questions about how I did that to see where I got wrong :
1/ The game is one single scene (including Save Game Manager and Save Game Master).
Is there any reason with EZ Game Saver to make 2 different scenes like the demo one ?

2/ My game is made of objects that are actually clones (copies) of a single prefab. I mean I clone and place them in the editor because I need to see where they are when editing).
Thats' why I'm not sure if I should consider them as "Dynamically-Created Objects".
or "Statically-Created Objects"

3/ Linked to this I may mistake the way I set GameData Saver. Of course I first attached it on my prefab, checked what I need to be saved (actually rotation only) and updated all my clones in the scene.
But know I don't really understand the Save Tier thing.
By défaut it's setted to "Save Game" but if I let it like this nothing happens. If I set to "Profile" or "Global" it seems it saves after quitting/reopening the published game, but only if I set a different Key Name for all clones !!
I see the little pego chips of the demo are not setted like this (their prefab is on "Save Game", not profile) so I guess I should be able to get a full saving without entering a key for each clone… Or does this only work IF I LITTERALY "dynamically instantiate them" ?


4/ Last, I did nothing about the "Initating a game save in script" the doc talks about.
I did not understand if this is due to nor where and how the "simple line of code" should be typed ?

"SaveGameMaster.instance.Save("profile name", slotNum, name);"


OK so definitely I think there are many basics about EZ GS I don't get even reading and re-reading the doc again and again.
Any help / track to follow greatly appreciated.
lasco
 
Posts: 5
Joined: Sat Sep 24, 2011 2:30 pm

Re: How to… get started ?

Postby Brady » Sun Sep 25, 2011 7:37 pm

1) Yes, though I believe some have done it with a single scene, I do recommend at least making a "dummy" first scene with the SaveGameMaster object. This is partly because whenever you load a savegame, it will call Application.LoadLevel() to load the scene wherein the game was saved.

2) These would be "statically-created" objects since they were created in-editor, not instantiated at runtime.

3) You need to use the Save Game tier for data that needs to be saved on a per-savegame basis. The profile and global tiers, as the documentation describes, are for saving pieces of data which apply profile-wide, or globally, regardless of the specific savegame. In other words, a high score would probably go in the global tier, so that all players can see the high score. A player's list of achievements, etc, would go in the profile tier, because it applies to that player (profile), regardless of which savegame is loaded.

4) This is referring to telling EZ Game Saver to save a game. You just call that one line of code you posted to do that. The first argument is the name of the player profile for which to save the game, then the save slot number, and then finally you can provide a descriptive name for the savegame if you like.

I think if you add the "dummy" first scene that has the SaveGameMaster and then immediately go on to load the "main" scene of your game, everything should fall into place. The one other thing I didn't see you mention is savegame loading. You must load a savegame to restore its data. Savegames are not automatically loaded, not even autosaves. So you need to have a line somewhere in your game (perhaps in the initial "dummy" scene) where you call:

SaveGameMaster.instance.Load("profile name", slotNum);
Brady
 
Posts: 5361
Joined: Tue Jul 06, 2010 11:33 pm

Re: How to… get started ?

Postby lasco » Mon Sep 26, 2011 8:04 am

thank you very much for reply, Brady.

I'm gonna give this a try and will come back if still miss something.
lasco
 
Posts: 5
Joined: Sat Sep 24, 2011 2:30 pm

Re: How to… get started ?

Postby lasco » Thu Sep 29, 2011 8:07 am

OK some more questions here.
Sorry if message is a bit long, english's not my primary langage.

I spent some time with the demo scene to understand how things work.
I must stay I still don't understand what means "just put a line of code" (reply to 3/ and 4/).

Obviously it's not just "a line" because it needs to be included in a whole script : almost impossible for people like me who do not know anything especially about C#.
I mean here I created a new script then typed :
Code: Select all
using UnityEngine;
using System.Collections;

public class SaveGame : MonoBehaviour {

   void Start () {
   SaveGameMaster.instance.Load("profile name", slotNum);
   }


of course this doesn't work due to "invalid arguments" and other console errors I don't understand.
I know there are missing things here but what ? It's definitely not "just a line"…
Sorry I miss the very base of syntax here.

Anyway, I played a while with the demo scene to learn who this works and I structured my own one the same way, step by step.
So now following your advice have a "dummy" loading scene and a main one. I also included your 2 scripts "Menu Controller" (in dummy scene) and "SaveButton" (in main scene).
I found out that the savegame and savegame loading lines were actually included respectively in
- MenuController (SaveGameMaster.instance.Load(SaveGameMaster.GetActiveProfile(), sg.saveNum);)
- SaveButton (SaveGameMaster.instance.Save(currentProfile, saveSlot, saveName);)

Which of course is better than my test mentioned above about including these lines "from scratch"…

Now the result is progress compared to the very beginning : everything displays correctly when launching, I can create or select profile as well as click save button during game.

BUT issue happens when I relaunch :
- if I select "New Game", no problem
- if I select "Resume", I get the list of savings but whatever one I select (manual saving or autosaving), I get the game freezed. All Mouse over / mouse clicks controls are disabled. The only thing that still works is moving camera with keys.

What is even more strange, especially according to what you're telling me, is that this issue disappears if I delete the SaveButton object and script from the scene. In that case of course I only keep the autosave function but at least this one works and I get the autosaved working game when I relaunch.
Though when I do that (deleting the save button) I do actually delete the gamesaving line (SaveGameMaster.instance.Save(currentProfile, saveSlot, saveName);) because it's included in the SaveButton script and nowhere else as I did not manage to include it another way…
I thought the bug could be due to some conflict, assuming this line maybe could be written twice which would have explain deleting one of them was making the game work. But I did not found this line anywhere else than in the savebutton script.

Sounds indeed like it works better when it does not include this line. I'm sure I missed something here, can you please give me some more help ?
lasco
 
Posts: 5
Joined: Sat Sep 24, 2011 2:30 pm

Re: How to… get started ?

Postby Brady » Sat Oct 01, 2011 6:29 am

Regarding the line of code, yes, it actually is just one line. As you found in the demo project, the line just has three arguments: 1) the profile name (which can be some dummy value if you aren't using separate player profiles in your game), 2) the save slot number, and 3) the "friendly name" of the savegame, if any - which is just a string you can use to store some user-friendly description of the savegame, if desired, but this can just be an empty string (such as "") if you don't plan to use that.

Regarding the resume, I'm not sure why removing the save button would fix the problem. That's really, really strange and I can't imagine why that would be the thing causing the problem. My guess is if you have brought over the menu code from the sample project entirely, there could be some little bit that doesn't match up with your project in some way, I'm not sure. But perhaps before you pursue that possibility, are there any console errors when it freezes? If Unity GUI isn't responding at all, I would think that would mean there's had to have been some major exception that occurred that should generate a console message.
Brady
 
Posts: 5361
Joined: Tue Jul 06, 2010 11:33 pm

Re: How to… get started ?

Postby lasco » Sun Oct 02, 2011 4:13 pm

Actually it's not exactly the Unity GUI that is not responding.
No console message about it.
But something even more strange happens here let me explain…

As I said, with the Save Button all my game buttons are freezed as well as highlighted colors when mousing over some game object and all triggers…
But 2 things still work :
- moving camera with keys
- and the Save Button itself. It's little bright when mousing over and especially if I click on it then quit then reload I do see its savings. But when I select one of them (or autosave) the game displays freezed.

The fact when I say it's not the whole Unity GUI that "crashes", is that my game buttons are NOT Unity Gui (OnGUI) ones but only simple GUITexture objects calling OnMouseClick / OnMouseOver, etc.

So I wanted to create a real Unity coded GUI button to see if it would freeze or not.
I just took the sample code of the manual and insert a dummy button for no special use, just to test.

Code: Select all
void OnGUI() {
if (GUI.Button(new Rect(10, 10, 50, 50), btnTexture))
Debug.Log("Clicked the button with an image");


And now what happens :
This dummy button works fine but the incredible is that the whole game works again when I click and relaunch. Everything's fine. I can save by clicking or autosaving and re-play in good positions without any freeze…
But it freezes again if I delete this dummy button from the scene !

Just like the game needs this dummy button to understand your codes…

Any idea about it ?
lasco
 
Posts: 5
Joined: Sat Sep 24, 2011 2:30 pm

Re: How to… get started ?

Postby Brady » Mon Oct 03, 2011 6:35 pm

That's really strange, but it sounds like some kind of Unity GUI (and GUITexture is part of Unity GUI) issue, not an EZ Game Saver issue. Make sure all your Unity GUI calls are inside OnGUI(). I'm not sure what else to suggest, but it definitely sounds like some kind of GUI problem.
Brady
 
Posts: 5361
Joined: Tue Jul 06, 2010 11:33 pm

Re: How to… get started ?

Postby lasco » Mon Nov 14, 2011 11:21 am

Hello Brady,

Back for some more request.
First I'd mention to you there is a minor mistake in the "demo" source code you provided, in the MenuController script.
In Void DrawSaveGamePage() function you typed
Rect scrollClientRect = new Rect(0, 0, 100, Mathf.Max((selectBtnHeight+5) * profiles.Count, 380));
instead of
Rect scrollClientRect = new Rect(0, 0, 100, Mathf.Max((selectBtnHeight + 5) * saves.Count, 380));

Guess you copied-pasted this line from void DrawProfilePage() function, few lines above, but this causes that the scroll bar for getting savings does'nt work (not even in pego demo scene) as it's height is based on the profiles count…

Not too serious, anyway. Just mentionned it for information.

Now I have some more complicated request : I need to display all my savings (mean savings for a given profile) on the main screen of the game. Currently the only way to go from one "step" to the other is to quit and relaunch the game. The fact that saving feature involves 2 scenes of course does not allow it this way. I guess it would be needed to take parts of the MenuController script (that is included in the level 0 launching scene) and re-paste them in the level 1 scene, as all calling savings interface is included in there, but for the moment what I'm trying does'nt work.

Any help / track to follow on this purpose, please ?
PS : did not found any similar request / post on the forum but may have missed it. If there is any please let me know and I'll try to get start with it.

The only thing I can do for the moment is adding a button to load level 0. Better than nothing but having list of a player savings directly on it's play screen would be simplier…
lasco
 
Posts: 5
Joined: Sat Sep 24, 2011 2:30 pm

Re: How to… get started ?

Postby Brady » Wed Nov 16, 2011 12:24 am

I guess I don't understand the request. You can get a list of all save games and do with it whatever you need to do in any scene of your game. I'm sure I'm just not understanding what you need though.
Brady
 
Posts: 5361
Joined: Tue Jul 06, 2010 11:33 pm

Re: How to… get started ?

Postby valamun » Mon Apr 16, 2018 9:02 am

ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218ac23218
ac23218
valamun
 
Posts: 20840
Joined: Sat Mar 17, 2018 5:46 pm


Return to EZ Game Saver How to...

Who is online

Users browsing this forum: No registered users and 1 guest