Hangs on Data Saving.

Discussion and help for Easy Save 3
deverydoo
Posts: 8
Joined: Sun May 05, 2019 11:45 pm

Hangs on Data Saving.

Post by deverydoo »

This all happens at the beginning of my game when it loads the data or converts it from PlayerPrefs... . At the bottom I pasted from the Unity logs.
I'm building a .sav file in the Working directory for Steam AutoCloud saves. When in the Unity editor it all works and the directory and save file are created.


When running the Beta build, from steam it creates the directory. The temp (*.tmp) file and then hangs there. It never completes the write. This prevents the game from ever loading as it sits there forever.

Below is the save function. I'm using dictionarys because Hashtables were not listed as being supported. I save in the "SaveDir" in the working directory as Steam suggests.

public void Save()
{
if(Directory.Exists(Directory.GetCurrentDirectory() + "/" + savePath) == false)
{
Debug.Log("Creating Save dir");
Directory.CreateDirectory(Directory.GetCurrentDirectory() + "/" + savePath);
}

var settings = new ES3Settings(ES3.EncryptionType.AES, passToken);
settings.path = fullPath;

Debug.Log("SAVING TO: " + fullPath + " " + settings.path);
ES3.Save<Dictionary<string, string>>("GameData", table, fullPath, settings);
}





SteamAchievements is loaded.
Gamedatamanager is loaded.
Uploading Crash Report
TypeLoadException: Type list could not be initialised. Please contact Easy Save developers on mail@moodkie.com.
at ES3Internal.ES3TypeMgr.Init () [0x00000] in <00000000000000000000000000000000>:0
at ES3Internal.ES3TypeMgr.GetOrCreateES3Type (System.Type type, System.Boolean throwException) [0x00000] in <00000000000000000000000000000000>:0
at ES3Writer.Write (System.Object value, ES3+ReferenceMode memberReferenceMode) [0x00000] in <00000000000000000000000000000000>:0
at ES3Internal.ES3JSONWriter.StartWriteProperty (System.String name) [0x00000] in <00000000000000000000000000000000>:0
at ES3Writer.Write[T] (System.String key, System.Object value) [0x00000] in <00000000000000000000000000000000>:0
at ES3.Save[T] (System.String key, System.Object value, ES3Settings settings) [0x00000] in <00000000000000000000000000000000>:0
at DataUtil.Save () [0x00000] in <00000000000000000000000000000000>:0
at DataUtil.Load () [0x00000] in <00000000000000000000000000000000>:0
at ConfigManager.InitGlobal () [0x00000] in <00000000000000000000000000000000>:0
at ConfigManager.Awake () [0x00000] in <00000000000000000000000000000000>:0

(Filename: currently not available on il2cpp Line: -1)

Player controller is loaded.
Screen___width:{0}, height:{1}3840 2160
WARNING: Shader Unsupported: 'Standard' - Pass 'META' has no vertex shader
WARNING: Shader Unsupported: 'Standard' - Pass 'META' has no vertex shader
Uploading Crash Report
TypeLoadException: ES3Type for primitive could not be found, and the type list is empty. Please contact Easy Save developers at http://www.moodkie.com/contact
at ES3Internal.ES3TypeMgr.CreateES3Type (System.Type type, System.Boolean throwException) [0x00000] in <00000000000000000000000000000000>:0
at ES3Internal.ES3TypeMgr.GetOrCreateES3Type (System.Type type, System.Boolean throwException) [0x00000] in <00000000000000000000000000000000>:0
at ES3Writer.Write (System.Object value, ES3+ReferenceMode memberReferenceMode) [0x00000] in <00000000000000000000000000000000>:0
at ES3Internal.ES3JSONWriter.StartWriteProperty (System.String name) [0x00000] in <00000000000000000000000000000000>:0
at ES3Writer.Write[T] (System.String key, System.Object value) [0x00000] in <00000000000000000000000000000000>:0
at ES3.Save[T] (System.String key, System.Object value, ES3Settings settings) [0x00000] in <00000000000000000000000000000000>:0
at DataUtil.Save () [0x00000] in <00000000000000000000000000000000>:0
at DataUtil.SetIntMD5 (System.String strKey, System.Int32 newVal) [0x00000] in <00000000000000000000000000000000>:0
at SteamAchievements.ReconcileWithSave () [0x00000] in <00000000000000000000000000000000>:0
Now available on Steam and XBox!
https://www.animalfriendsAdventure.com
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Hangs on Data Saving.

Post by Joel »

Hi there,

The "Type list could not be initialised" error suggests that Reflection used to get types is not working. As this is a very simple piece of code, this either suggests a bug at Unity's end, or another asset contains unsafe code which is interfering Unity's Reflection libraries. As we've had no other reports of this happening in the way you've described it, it's likely to be the latter.

Please could you place this script in the same scene where your Easy Save code is throwing an error, and ensure that it's Awake() method is called before your Easy Save code runs. Could you then let me know what is outputted to console on iOS?
using UnityEngine;
using System.Reflection;
 
public class GetAssemblies : MonoBehaviour
{
    public void Awake()
    {
        var assembly = Assembly.Load("Assembly-CSharp-firstpass");
        if(assembly == null)
            Debug.LogError("Couldn't load assembly Assembly-CSharp-firstpass");
        var types = assembly.GetTypes();
        Debug.Log("Type list length:" + types.Length);
    }
}
If this particular script throws any errors or has a type list length of zero, please could you then make a new project containing only Easy Save with a scene containing the following script and let me know what is output to console when the scene is executed on iOS.
using UnityEngine;
using System.Reflection;
 
public class EasySaveTest : MonoBehaviour
{
    public void Awake()
    {
        var assembly = Assembly.Load("Assembly-CSharp-firstpass");
        if(assembly == null)
            Debug.LogError("Couldn't load assembly Assembly-CSharp-firstpass");
        var types = assembly.GetTypes();
        Debug.Log("Type list length:" + types.Length);

        ES3.Save<Transform>("myTransform", this.transform);
    }
}
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
deverydoo
Posts: 8
Joined: Sun May 05, 2019 11:45 pm

Re: Hangs on Data Saving.

Post by deverydoo »

Here's the output. I started at the typlist and went through to the error area.


Type list length:477
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
AGetAssemblies:Awake()

(Filename: C:\buildslave\unity\build\Runtime/Export/Debug.bindings.h Line: 45)

Player controller is loaded.
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
RewiredPlayerManager:Awake()

(Filename: C:\buildslave\unity\build\Runtime/Export/Debug.bindings.h Line: 45)

Gamedatamanager is loaded.
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)

(Filename: C:\buildslave\unity\build\Runtime/Export/Debug.bindings.h Line: 45)

SAVING TO: C:/Users/Craig/AppData/LocalLow/Chaos Rift Entertainment, LLC/Animal Friends Adventure/AnimalFriendsAdventure.sav
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
DataUtil:Save()
DataUtil:Load()
ConfigManager:InitGlobal()
ConfigManager:Awake()

(Filename: C:\buildslave\unity\build\Runtime/Export/Debug.bindings.h Line: 45)

Uploading Crash Report
TypeLoadException: Type list could not be initialised. Please contact Easy Save developers on mail@moodkie.com.
at ES3Internal.ES3TypeMgr.Init () [0x00000] in <00000000000000000000000000000000>:0
at ES3Internal.ES3TypeMgr.GetOrCreateES3Type (System.Type type, System.Boolean throwException) [0x00000] in <00000000000000000000000000000000>:0
at ES3Writer.Write (System.Object value, ES3+ReferenceMode memberReferenceMode) [0x00000] in <00000000000000000000000000000000>:0
at ES3Internal.ES3JSONWriter.StartWriteProperty (System.String name) [0x00000] in <00000000000000000000000000000000>:0
at ES3Writer.Write[T] (System.String key, System.Object value) [0x00000] in <00000000000000000000000000000000>:0
at ES3.Save[T] (System.String key, System.Object value, ES3Settings settings) [0x00000] in <00000000000000000000000000000000>:0
at DataUtil.Save () [0x00000] in <00000000000000000000000000000000>:0
at DataUtil.Load () [0x00000] in <00000000000000000000000000000000>:0
at ConfigManager.InitGlobal () [0x00000] in <00000000000000000000000000000000>:0
at ConfigManager.Awake () [0x00000] in <00000000000000000000000000000000>:0
Now available on Steam and XBox!
https://www.animalfriendsAdventure.com
deverydoo
Posts: 8
Joined: Sun May 05, 2019 11:45 pm

Re: Hangs on Data Saving.

Post by deverydoo »

I got past the "hang" by putting the Save function into a Coroutine and waiting till the end of frame. But...

It never writes the .sav file. Only the .tmp "AnimalFriendsAdventure.sav.tmp"

The Unity log then filled up with quite a bit more errors from Easy save.

With the Playerprefs, on new player I was sending a bunch of one liner save items to initialize the game. Now I'm dumping everything into a single Dictionary save. It's only 1k size. Not a lot of data.

Easy Save doesn't seem to keep up with this (bad) style.
Now available on Steam and XBox!
https://www.animalfriendsAdventure.com
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Hangs on Data Saving.

Post by Joel »

Hi there,

Just to clarify, it's not hanging, it's hitting an Exception, so the file will never be written until the cause of the Exception is addressed.

Please could you PM me a basic project which replicates this?

Also are you using Assembly Definitions, or using any code obfuscation plugins which might interfere with or change the code upon building?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
deverydoo
Posts: 8
Joined: Sun May 05, 2019 11:45 pm

Re: Hangs on Data Saving.

Post by deverydoo »

Joel,

I did as you mentioned. I made a new project, and moved all the game manager and save scripts to that project. and It darn worked. I ran this in the Editor (which never failed in original project) and I did a standalone build (which failed in original project)

This bug only happens when I deploy the App to Steam. There might be something in the Steamworks.net API that's blocking and causing the exception.

This really has be perplexed.
Now available on Steam and XBox!
https://www.animalfriendsAdventure.com
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Hangs on Data Saving.

Post by Joel »

Hi there,

That's very strange. Similarly to before, please could you run the following code for me and let me know the output?
using UnityEngine;
using System.Reflection;
  
public class GetAssemblies : MonoBehaviour
{
    public void Awake()
    {
        var assembly = Assembly.Load("Assembly-CSharp-firstpass");
        Debug.Log("Checking for types");
        foreach (var type in assembly.GetTypes())
		if (typeof(ES3Type).IsAssignableFrom(type)) 
                    Debug.Log(type)
    }
}
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
deverydoo
Posts: 8
Joined: Sun May 05, 2019 11:45 pm

Re: Hangs on Data Saving.

Post by deverydoo »

ES3Type shows an error in VS2017. The only thing that pops ups is ES3Types.
I completely reinstalled ES3 and still has that type error.


f (typeof(ES3Type).IsAssignableFrom(type))
Debug.Log(type);
Now available on Steam and XBox!
https://www.animalfriendsAdventure.com
deverydoo
Posts: 8
Joined: Sun May 05, 2019 11:45 pm

Re: Hangs on Data Saving.

Post by deverydoo »

I modified the loop to dump all the types. Here's all the ES* related ones. A huge majority of the types belonged to Steam.

ES2AutoSave
ES2AutoSaveComponentInfo
ES2AutoSaveVariableInfo
IES2Selectable
ES2AutoSaveGlobalManager
ES2AutoSaveManager
ES2DirectoryUtility
ES2Dispose
ES2FileUtility
ES2TypeUtility
ES2
ES2Auto
ES2Cache
ES2CachedFile
ES2Tag
ES2Data
ES2EditorWindowStyle
ES2File
ES2Reflection
ES2Spreadsheet
ES2SpreadsheetRow
ES2Web
ES2Header
ES2Reader
ES2InvalidDataException
ES2FilenameData
ES2GlobalSettings
ES2Keys
ES2Settings
ES2FileStream
ES2MemoryStream
ES2PlayerPrefsStream
ES2ResourcesStream
ES2Stream
ES2_BoneWeight
ES2_Bounds
ES2_Color
ES2_Color32
ES2_DateTime
ES2_Enum
ES2_ES2AutoSaveManager
ES2_Gradient
ES2_GradientAlphaKey
ES2_GradientColorKey
ES2_Material
ES2_Matrix4x4
ES2_Mesh
ES2_Quaternion
ES2_Rect
ES2_Sprite
ES2_Texture
ES2_Texture2D
ES2_Vector2
ES2_Vector3
ES2_Vector4
ES2_BoxCollider
ES2_CapsuleCollider
ES2_MeshCollider
ES2_PolygonCollider2D
ES2_SkinnedMeshRenderer
ES2_SphereCollider
ES2_Transform
ES2Type
ES2TypeManager
ES2_bool
ES2_byte
ES2_char
ES2_decimal
ES2_double
ES2_float
ES2_int
ES2_long
ES2_object
ES2_sbyte
ES2_short
ES2_string
ES2_uint
ES2_ulong
ES2_ushort
ES2Writer
ES3AutoSave
ES3AutoSaveMgr
ES3
ES3File
ES3InspectorInfo
ES3ReferenceMgr
ES3Spreadsheet
ES3Reader
ES3Settings
ES3SerializableSettings
ES3Cloud
ES3Writer
Now available on Steam and XBox!
https://www.animalfriendsAdventure.com
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Hangs on Data Saving.

Post by Joel »

Hi there,

It sounds like the entire ES3Types class and those which derive from it is being excluded. This is very strange because the library relies on ES3Type, it technically shouldn't compile.

Please could you try building it for Windows/Mac and see if the same issue happens? That way we can rule out it being a Steam issue.

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