bayatgames / savegamefree Goto Github PK
View Code? Open in Web Editor NEWSave Game Free is a free and simple but powerful solution for saving and loading game data in unity.
License: MIT License
Save Game Free is a free and simple but powerful solution for saving and loading game data in unity.
License: MIT License
Describe the bug
UnityWebRequest.Send() is obsolete and is used in SaveGameFree/Scripts/SaveGameWeb.cs(578,17)
. I received the following warning when importing SaveGameFree into Unity 2019.4.20f1
Assets/_PluginsMIT/SaveGameFree/Scripts/SaveGameWeb.cs(578,17): warning CS0618: 'UnityWebRequest.Send()' is obsolete: 'Use SendWebRequest. It returns a UnityWebRequestAsyncOperation which contains a reference to the WebRequest object.'
When did it become obsolete?
Looking at different versions of the documentation it looks like this became obsolete in 2017.2.
What should it be replaced with?
The Unity 2019.4 Documentation shows how to do it the new way for a get and the same approach for post using that exact approach I have no errors or warnings in 2019.4.20f1 (and will submit a pull request momentarily) so it seems to work.
To Reproduce
To get the warning just import the latest version of SaveGameFree into Unity 2019.4.20f1 and look at the warning in the console.
Additional context
I'll submit a pull request with a proposal, and will make clear in the pull request that while my fix (which I took directly from the documentation and theres no ingenuity involved at all) solves the warning with no errors but I don't have a way to actually test the UnityWebRequest functionality.
I want to get the information like (Position, Rotation, Scaling and other custom information) of Multiple game objects and save that information as a JSON File. But, the issue I am facing right now that I am only getting information as a string.
Can any one please guide me about this how can I get all information in a single file using this asset.
Hello,
I'm using this repo to handle my saves. So far so good when using the editor and with my Android build.
When I build on Windows however, and I try to execute the .exe
there's an issue.
I am calling the DeleteAll
method. The method tries to remove everything in the folder, including the output_log.txt
which is by default put in that folder by Unity.
This makes the whole game crash, since it tries to delete a file that the game needs to access at every moment ( basically I have an IOException Cannot access file output_log.txt because it is being used by another process
).
It also removes the Analytics folder
that gets created, this doesn't let the game crash but I guess is not exactly intended.
I think we should either avoid having the saves in the same folder as the output_log.txt
or explicitly ignore that file (and probably the Analytics folder)
I can save a bool with a password, but i cant load it from file with same password. There is no documentation on loading the data, can you help me?
Describe the bug
This warning appears in Unity 2019.4.20f1 (LTS) and based on the warning text it probably also appears in 2017.3+
warning CS0618: 'RuntimePlatform.SamsungTVPlayer' is obsolete: 'SamsungTVPlayer export is no longer supported in Unity 2017.3+.'
To Reproduce
Steps to reproduce the behavior:
Expected behavior
This warning should not appear and doesn't need to appear with the right Platform Dependent Preprocessor settings.
Describe the bug
Deleting a save game in a standalone build doesn't work because Player.log is currently being used by a process. I've ended all processes except the game but it doesn't work. I tried restarting my computer as well
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should clear all saved data.
Screenshots
After clicking new game, this error appears
Error message:
IOException: The process cannot access the file 'C:\Users\hi\AppData\LocalLow\company\game name\Player.log' because it is being used by another process.
at System.IO.__Error.WinIOError (System.Int32 errorCode, System.String maybeFullPath) [0x001d7] in <2b3a3162be434770b7a4fac8b896e90c>:0
at System.IO.FileInfo.Delete () [0x00038] in <2b3a3162be434770b7a4fac8b896e90c>:0
at BayatGames.SaveGameFree.SaveGame.DeleteAll (BayatGames.SaveGameFree.SaveGamePath path) [0x00037] in <81391f8c6baa4ae7b039f97e592f680c>:0
at BayatGames.SaveGameFree.SaveGame.Clear () [0x00005] in <81391f8c6baa4ae7b039f97e592f680c>:0
at QLE.NormalPanel.ClearSavedData () [0x00001] in E:\projects\game name\Assets\Scripts\UI\Main Menu\NormalPanel.cs:50
at UnityEngine.Events.InvokableCall.Invoke () [0x00010] in C:\buildslave\unity\build\Runtime\Export\UnityEvent\UnityEvent.cs:180
at UnityEngine.Events.UnityEvent.Invoke () [0x00022] in C:\buildslave\unity\build\Runtime\Export\UnityEvent\UnityEvent\UnityEvent_0.cs:58
at UnityEngine.UI.Button.Press () [0x00027] in E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Button.cs:68
at UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00010] in E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Button.cs:110
at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00001] in E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\ExecuteEvents.cs:50
at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) [0x00074] in E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\ExecuteEvents.cs:262
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1) (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\ExecuteEvents.cs:266)
UnityEngine.EventSystems.StandaloneInputModule:ReleaseMouse(PointerEventData, GameObject) (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs:187)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMousePress(MouseButtonEventData) (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs:641)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent(Int32) (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs:547)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent() (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs:527)
UnityEngine.EventSystems.StandaloneInputModule:Process() (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs:282)
UnityEngine.EventSystems.EventSystem:Update() (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\EventSystem.cs:385)
Desktop:
the code in the button is just
btw, the scriptable object code does not do any calls in SaveGame
Hello. Not sure if anyone else has experienced this problem, but the identifiers stop working for some reason after importing another unrelated asset (might be coincidental, can't confirm, and those imported assets has nothing to do with saving, so it shouldn't be incompatibility issues), unabling me to load or save anything (i also tested the examples scenes and the problem appeared too). I tried re importing the asset, but it didn't solve anything. Delenting the other imported assets didn't help, either.
Update: I found out the problem. After scratching my head for days, i decided to just switch Platform to the default WIndows and the identifiers worked again and it could save once move. So i doesn't have to do with any asset compatibility.... It just doesn't work with WebGL, so, there is still a problem (at least inside the editor, haven't tested it published). I tested it with other platforms, like Android and iOS, and they work too, being WebGL the only one which doesn't work. If anyone know the solution for this, let me know.
Is there anyway to do fast encryption (I dont need a zero go to a 100 char long code... 4 or something like this would be enough,,, becaues I need to save more than 200 files and this takes around 10 secounds (annoying) and loading also takes long...
would be nice if you can help me.
By the way this tool is awesome!
Hello! I've using SaveGameFree for some time without problems but when I changed my code to use encoding and encryption it fails to load serialized data.
I'm using the current asset store version and received the error in both Unity 2017.3.1f1 and Unity 2018.1.1f1. I'm using Windows 7 64-bits and my project is targeting Android (IL2CPP).
The error is:
SerializationException: Invalid binary format
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadRefTypeObjectInstance (System.IO.BinaryReader reader, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:281)
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:179)
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (BinaryElement element, System.IO.BinaryReader reader) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:130)
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:104)
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:179)
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:136)
BayatGames.SaveGameFree.Serializers.SaveGameBinarySerializer.Deserialize[StorageSG] (System.IO.Stream stream, System.Text.Encoding encoding) (at Assets/BayatGames/SaveGameFree/Scripts/Serializers/SaveGameBinarySerializer.cs:57)
UnityEngine.Debug:LogException(Exception)
BayatGames.SaveGameFree.Serializers.SaveGameBinarySerializer:Deserialize(Stream, Encoding) (at Assets/BayatGames/SaveGameFree/Scripts/Serializers/SaveGameBinarySerializer.cs:61)
BayatGames.SaveGameFree.SaveGame:Load(String, StorageSG, Boolean, String, ISaveGameSerializer, ISaveGameEncoder, Encoding, SaveGamePath) (at Assets/BayatGames/SaveGameFree/Scripts/SaveGame.cs:675)
BayatGames.SaveGameFree.SaveGame:Load(String, Boolean, String) (at Assets/BayatGames/SaveGameFree/Scripts/SaveGame.cs:450)
Assets.Scripts.TestSaveGameFreeEncoder:Start() (at Assets/Scripts/TestSaveGameFreeEncoder.cs:35)
Here is a test code that gives the same error I received in my actual project.
namespace Assets.Scripts
{
[System.Serializable]
public class StorageSG
{
public DateTime myDateTime;
public StorageSG()
{
myDateTime = DateTime.UtcNow;
}
}
public class TestSaveGameFreeEncoder : MonoBehaviour
{
private string _encodePassword;
private void Start()
{
_encodePassword = "12345678910abcdef12345678910abcdef";
SaveGame.DefaultEncoding = Encoding.UTF8;
SaveGame.Encode = true;
ISaveGameSerializer sgBinarySerializer = new SaveGameBinarySerializer();
SaveGame.Serializer = sgBinarySerializer;
StorageSG ssg = new StorageSG();
SaveGame.Save<StorageSG>("pizza2", ssg, _encodePassword);
StorageSG ssgLoaded = SaveGame.Load<StorageSG>("pizza2", true, _encodePassword);
Debug.Log(ssgLoaded.myDateTime.ToLocalTime().ToString());
}
}
}```
Thanks in advance.
Hello
the included 'documentation' files (pdf, rtf, doc, html) are not really a documentation, just an introduction that link to documents on the web. That would have been fine but sadly all the web links return 404.
e.g. http://docs.bayat.io/scripting-api/savegame/save
etc
Hi,
Thank you for this great resource. I have used the awake function as shown in the Demo to initialize save and load, but when I try calling Saver.Load in other places in my code, I get:
NullReferenceException: Object reference not set to an instance of an object
SaveGameFree.Saver.Save (System.Object obj, System.String fileName, ISerializer serializer, PathType savePath, System.String extension) (at Assets/SaveGameFree/Saver.cs:527)
SaveGameFree.Saver.Load[StripesData] (System.String fileName, ISerializer serializer, PathType savePath, System.String extension) (at Assets/SaveGameFree/Saver.cs:625)
SaveGameFree.Saver.Load[StripesData] (System.String fileName) (at Assets/SaveGameFree/Saver.cs:539)
GameManager.Start () (at Assets/scripts/GameManager.cs:38)
Any idea what the problem could be here? I cannot understand why calling 'Saver.Load' in the awake function works but calling the same function elsewhere doesn't. Thanks in advance.
Hi! Are there any callbacks in cases where the loading process fails, like if there's a corrupted file which could not be decrypted or serialized correctly? (SaveGame.Exists() wont suit my needs this time).
It would be realy nice if there were an option for backup/versioning saving, where it could for example add a cycling index at the end of the ID. Then, if it failed to load using the last saved index, it would try loading a previous one.
This backup system is what I'm trying to implement and the reason I need the failure callback btw, please let me know if there is another way to do so.
Thanks in advance!
DeleteAll() purges all Assets folder when path set to dataPath. Is it able to make it delete only the folder that plugin creates, like some /Saves/?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.