REQUEST EXAMPLES AND TUTORIALS HERE

Examples using Easy Save's API code
dafar
Posts: 6
Joined: Mon Feb 24, 2020 4:23 am

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by dafar »

Hi, Joel. Thanks.

I don't know if I asked corretly what I need.

The idea is to have a popup where, during gameplay, the user can find where he wants to save the file.
To let it be a user decision where to save (and the filename) and not a coder decision.
User avatar
Joel
Moodkie Staff
Posts: 4824
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

dafar wrote: Tue May 25, 2021 11:00 pm Hi, Joel. Thanks.

I don't know if I asked corretly what I need.

The idea is to have a popup where, during gameplay, the user can find where he wants to save the file.
To let it be a user decision where to save (and the filename) and not a coder decision.
Hi there,

It sounds like you're after a File Picker Dialog. Easy Save does not include this functionality but we have a feature request for this which you can vote on here:

https://moodkie.com/forum/viewtopic.php?f=14&t=1237

In the meantime you might be able to create your own file picker using the ES3.GetFiles and ES3.GetDirectories methods.

Also note that a File Picker will only work on PC/Mac standalone as all other platforms are sandboxed, so you're only able to access one folder within the file system.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
b0ngjicat
Posts: 1
Joined: Tue Jul 27, 2021 5:14 am

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by b0ngjicat »

Hello.

I don't speak English well, so I use a translator. I'll put the original text below for your reference.

What I want to do is simply save and load the player's Scene location.
However, even after reading the guide, I did not understand how to do it.

There are not a lot of related Korean material, so I am having a hard time making a game.

I don't need to explain in Korean, so can you make an English example of loading the scene?

(It would be more helpful if you tell me an example file or coding method.)

Thank you.

안녕하세요.

저는 영어를 잘 사용하지 못해 번역기를 사용합니다. 참고를 위해 원문을 아래에 적어 놓겠습니다.

제가 하고 싶은 것은 단순히 플레이어의 Scene 위치를 저장하고 불러오는 것 입니다.
그러나 가이드를 읽어봐도 어떻게 하면 될지 이해를 하지 못했습니다.

관련된 한국어 자료가 많이 없어서 게임을 제작하는데 어려움을 겪고 있습니다.

한국어로 설명을 해주시지 않아도 괜찮으니 씬 불러오기 영어 예제를 만들어 주실 수 있으십니까?

감사합니다.
User avatar
Joel
Moodkie Staff
Posts: 4824
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

Hi there,

If your question is around saving the location of a player in a scene, there is an example of this here:
https://moodkie.com/forum/viewtopic.php?f=16&t=1889

If you mean saving the name of the scene, I already responded to your email regarding this. Here is what I sent:
Hi there,

If you want to store the scene a player is in, you can use the following code to save it:

ES3.Save("scene", SceneManager.GetActiveScene().name);

And then to load it:

SceneManager.LoadScene(ES3.Load<string>("scene"));

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
zephyrus.mck
Posts: 5
Joined: Thu Aug 19, 2021 11:16 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by zephyrus.mck »

I would like to know how to store a List of data with ES3. The syntax doesn't seem to match well when saving and loading lists or arrays, or at least my understanding of the syntax.

For example, let say I have 5 of the same script in a scene that handles secrets in different areas of the same level. Lets call it Secret.cs. When all of the secrets are found within that area that areas secret script will give the player something, by doing so the script has a bool that is set active - lets say _areaComplete. Now in the save script I believe I would do something like this:

List<Secret> secrects = new List<Secret>();

Start()
{
Secret[] S = FindObjectsOfType<Secret>();
for (int i = 0; i < S.Length; i++)
{
secrects.Add(S);
for (int j = 0; j < secrects.Count; j++)
{
foreach (Secrect se in secrects)
{
if (se._AreaComplete)
{
ES3.Save<Secret>("SecretResult", secrects[se], DefaultPath); ;
}
}
}
}
}
With that, I believe that it would get all of the secret scripts that have areas completed and add them to a save file. Then on load, when I need to start the game from a save point I would ask which ones were complete, if they were, those ones would be set inactive.

I seem to run into an error like this:
InvalidOperationException: An Easy Save 3 Manager is required to load references. To add one to your scene, exit playmode and go to Assets > Easy Save 3 > Add Manager to Scene ES3Types.ES3UnityObjectType.WriteObject (System.Object obj, ES3Writer writer, ES3+ReferenceMode mode) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3UnityObjectType.cs:46) ES3Writer.Write (System.Object value, ES3Types.ES3Type type, ES3+ReferenceMode memberReferenceMode) (at Assets/Plugins/Easy Save 3/Scripts/Writers/ES3Writer.cs:219) ES3Writer.WriteProperty (System.String name, System.Object value, ES3Types.ES3Type type, ES3+ReferenceMode memberReferenceMode) (at Assets/Plugins/Easy Save 3/Scripts/Writers/ES3Writer.cs:286) ES3Writer.Write (System.Type type, System.String key, System.Object value) (at Assets/Plugins/Easy Save 3/Scripts/Writers/ES3Writer.cs:142) ES3Writer.Write[T] (System.String key, System.Object value) (at Assets/Plugins/Easy Save 3/Scripts/Writers/ES3Writer.cs:129) ES3.Save[T] (System.String key, T value, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:106) ES3.Save[T] (System.String key, T value) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:67) Saving.Start() (at Assets/Scripts/Saving/Saving.cs:159) UnityEngine.Events.InvokableCall.Invoke () (at <cfc1ad890650411e946cff2e6f276711>:0) UnityEngine.Events.UnityEvent.Invoke () (at <cfc1ad890650411e946cff2e6f276711>:0) UnityEngine.UI.Button.Press () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:68) UnityEngine.UI.Button.OnSubmit (UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:146) UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.ISubmitHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:127) UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:262) UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:385)


That error doesn't really make sense, because I don't have Assets > Easy Save 3 > Manager - my file path is
Project\Assets\Plugins\Easy Save 3
inside those folders there is a script named manager, but when that is added to a game object in the scene it says the say thing to add it from that folder.
I do not need anything that can be added that is not an internal script.


All I need to do is save the values of a List of scripts that meet the requirements to save. Then on load, tell the scripts that the requirements are met and they do not need to be active. I have read over almost every articles on this site alone on syntax, and search for loops, lists, arrays, everything I could find, and I have not seen anyone post about this. Perhaps I am the first one using this on a large scale, I don't know - but I can 100% say that this link - https://docs.moodkie.com/easy-save-3/getting-started/ - which is referenced many times as an answer for others questions, does not help at all - for one it doesn't even deal with instanced arrays or how to reference a value within 1 of the arrays.

This seems like something that would be covered in the basics, or maybe there should be an advanced section for thing, I'm not sure. But I have been ALL over this site, and I cannot find a single thing that helps me with this.

I do have the save system working with many other aspects of the game, with a build and while in the engine. The I simply cannot get a List to work properly.

I don't know if you guys are even planning on doing an ES4 - but video tutorials and MASSIVE syntax databases would be a great improvement and cut out a ton of confusion. So far, this has been anything but easy from the start. I have had to basically learn a new language to work with the way that your syntax is set up and nothing in the getting started even worked to get me started, I had to find other peoples code that they generously shared on other questions that were posted to piece together something that actually worked.

Please advise on this issue, I am more than welcome to PM you, call you, share screen, do anything you need to help me understand how to make everything work the way I need. I am even willing to pay extra for the help at this point as I have basically wasted hundreds of hours trying to figure out how ES3 is supposed to work.

Thank you,
User avatar
Joel
Moodkie Staff
Posts: 4824
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

Hi there,

You are mistaken. The error isn't asking you to go to a folder, it's asking you to go to the menu item Assets > Easy Save 3 > Add Manager to Scene.

Regarding saving and loading Lists, this is covered in the Saving and Loading Collections section of the Getting Started guide:
https://docs.moodkie.com/easy-save-3/ge ... ollections

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
zephyrus.mck
Posts: 5
Joined: Thu Aug 19, 2021 11:16 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by zephyrus.mck »

Joel wrote: Sat Aug 21, 2021 10:34 pm Hi there,

You are mistaken. The error isn't asking you to go to a folder, it's asking you to go to the menu item Assets > Easy Save 3 > Add Manager to Scene.

Regarding saving and loading Lists, this is covered in the Saving and Loading Collections section of the Getting Started guide:
https://docs.moodkie.com/easy-save-3/ge ... ollections

All the best,
Joel
That link you sent just send me to the getting started page again - which does not seem to have in depth code examples of how to use...anything, which make sense because its getting started; but that is not what I need.
Last edited by zephyrus.mck on Sun Aug 22, 2021 2:22 pm, edited 2 times in total.
User avatar
Joel
Moodkie Staff
Posts: 4824
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

Hi there,

I'm afraid we can only help with the Easy Save side of things. Any more detail is the logic in your code, which will differ from project to project and would be impossible for us to create an example which accounts for the infinite combinations of projects.

However, looking at your code to save your list you would do:

Code: Select all

ES3.Save<List<Secret>>("secrets", secrets);
And then to load it:

Code: Select all

secrets = ES3.Load<List<Secret>>("secrets", secrets);
You also didnt answer the main question I had...
Please could you confirm what this is? It's hard to understand from what you've said. The only questions I can see in your messages are:
All I need to do is save the values of a List of scripts that meet the requirements to save
And:
That error doesn't really make sense, because I don't have Assets > Easy Save 3 > Manager - my file path is
Project\Assets\Plugins\Easy Save 3
inside those folders there is a script named manager, but when that is added to a game object in the scene it says the say thing to add it from that folder.
Both of which I believe I answered in my first response.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
zephyrus.mck
Posts: 5
Joined: Thu Aug 19, 2021 11:16 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by zephyrus.mck »

Joel wrote: Sun Aug 22, 2021 2:10 pm Hi there,

I'm afraid we can only help with the Easy Save side of things. Any more detail is the logic in your code, which will differ from project to project and would be impossible for us to create an example which accounts for the infinite combinations of projects.

However, looking at your code to save your list you would do:

Code: Select all

ES3.Save<List<Secret>>("secrets", secrets);
And then to load it:

Code: Select all

secrets = ES3.Load<List<Secret>>("secrets", secrets);
You also didnt answer the main question I had...
Please could you confirm what this is? It's hard to understand from what you've said. The only questions I can see in your messages are:
All I need to do is save the values of a List of scripts that meet the requirements to save
And:
That error doesn't really make sense, because I don't have Assets > Easy Save 3 > Manager - my file path is
Project\Assets\Plugins\Easy Save 3
inside those folders there is a script named manager, but when that is added to a game object in the scene it says the say thing to add it from that folder.
Both of which I believe I answered in my first response.

All the best,
Joel

My mistake on the question, I believe it was not phrased correctly. How do I use "Assets > Easy Save 3 > Manager" ? - as doing

Code: Select all

ES3.Save<List<Secret>>("secrets", secrets);
seems to always state the InvalidOperationExpection - is there anything else that needs to be done before saving a list?

I believe one I am able to actually get a list saved I might be able to get the rest handled, that is the issue I am running into.
User avatar
Joel
Moodkie Staff
Posts: 4824
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

Hi there,

You should just be able to go to the Assets > Easy Save 3 > Add Manager to Scene menu item and this will add the manager to your scene, which will prevent your error.

If you're saying that you've pressed this menu item and it's not added a manager to your scene, or the error is still occurring despite there being a manager in your scene, please could you replicate this in a new, empty project with a simple scene and private message it to me with step-by-step instructions, as I've had no reports of this.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply