ES3.Load working on unity but not working on the windows build

Discussion and help for Easy Save 3
Post Reply
Ogirdorsoul
Posts: 4
Joined: Tue Feb 08, 2022 11:43 pm

ES3.Load working on unity but not working on the windows build

Post by Ogirdorsoul »

Hi,
I have a game that you can save a monster/magical power party to battle a random enemy party (offline/controller by IA).
My problem is: ES3.Save and ES3.Load is working as intended when I play the game on Unity but when I build it(Windows version) the load works for the monsters but not for the powers! I know the problem is the load because when I create a new party and play the game works fine, but when I try to save the party then load the magical power it is aparently returning null...
The save structure is at folows:

List<BetaAdventureBattleSave>

BetaAdventureBattleSave (registered es3 type)
{
public SaveCharacterStatus Player;
public SaveCharacterStatus Enemy;
public List<GameEvent> Events;
}

SaveCharacterStatus (registered es3 type)
{
public string CurrentPartyName;
public DuoMonster[] DuoMonsters; (registered es3 type) <- this works becase the monster party is being correctly loaded
public List<ElementPowerParent> ElementPowers; (registered es3 type) <- this is the problem
public int Switches;
}

ElementPowerParent (registered es3 type)
{
protected string Title;
public List<ElementPowerDataCost> Cost; (registered es3 type)
public int ElementPowerLevel;
public Sprite Image;
protected string Explaination;
public ElementPowerTargetOptions[] TargetOptions; (enum)
public bool CanSelectSameTarget = false;

public List<NeoCombatDuoMonster> EnemyEPGradeBetterDuoMonsterTarget = null; (not saved)
public List<NeoCard> EnemyEPGradeBetterCardTarget = null; (not saved)
}

ElementPowerDataCost (registered es3 type)
{
public Elements ElementCost; (enum)
public int QtdCost;
}

On the build extracted stack trace from AppData/LocalLow doesnt show any exception from ES3, just shows the first method that tried to use the loaded data trying to instantiate the powers but the object is null:
ArgumentException: The Object you want to instantiate is null.
at UnityEngine.Object.Instantiate (UnityEngine.Object original, UnityEngine.Transform parent, System.Boolean instantiateInWorldSpace) [0x00045] in <a9e6be22a257425c873a4117e5374c2e>:0
at UnityEngine.Object.Instantiate[T] (T original, UnityEngine.Transform parent, System.Boolean worldPositionStays) [0x00001] in <a9e6be22a257425c873a4117e5374c2e>:0
at UnityEngine.Object.Instantiate[T] (T original, UnityEngine.Transform parent) [0x00001] in <a9e6be22a257425c873a4117e5374c2e>:0
at NeoBench.AttachPowerLogic (ElementPowerParent power, System.Int32 pos) [0x00000] in <9debac61a8864f739108c35182b876fb>:0
at NeoBench.AttachElementPowersToPowerBag () [0x0007b] in <9debac61a8864f739108c35182b876fb>:0
at NeoCombatManager.Start () [0x001c0] in <9debac61a8864f739108c35182b876fb>:0
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3.Load working on unity but not working on the windows build

Post by Joel »

Hi there,

Have you accounted for the case where there will be no save data? You can replicate this by deleting your save data in the Editor (Tools > Easy Save 3 > Clear PersistentDataPath) and see if you get the same issue in the Editor.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Ogirdorsoul
Posts: 4
Joined: Tue Feb 08, 2022 11:43 pm

Re: ES3.Load working on unity but not working on the windows build

Post by Ogirdorsoul »

Hi Joel,
Thank you for your time. I cleared the PersistentDataPath as metioned and still no problem on the editor side. I still think something is going wrong on the ES3.Load. Let me try to explain what is going on with my script (and I have no problem sharing more details latter on):
-Player starts a battle request
-Player can either make a new party from scratch or load a saved one
-(player chose to make new party) -> then chose to save it
In this example the game will function with no problem because the magical powers he chose will be directly be loaded into the game manager
-(player chose to load a saved party)
On this one, the game will function on Unity editor but on the Windows Build it will not load the magical powers.

Some data about this project that could help you understand what is happening:
=ElementPowerParent is a parent class that all magical powers inherit from
=ElementPowerDataCost is a class but does not have a separate script just for him (but the ES3Type is working)
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3.Load working on unity but not working on the windows build

Post by Joel »

Hi there,

We’ve had no other reports of it not working on a Windows build, and Unity’s codebase for both Windows build and Editor is identical, so if there is a platform difference it would indicate a bug at Unity’s end.

Please could you create a new, minimal project with a very basic scene which replicates the issue and private message it to me with step-by-step instructions so I can see what is happening.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Ogirdorsoul
Posts: 4
Joined: Tue Feb 08, 2022 11:43 pm

Re: ES3.Load working on unity but not working on the windows build

Post by Ogirdorsoul »

Sure thing! I'm going to try to replicate my save structure on a basic scene!
Ogirdorsoul
Posts: 4
Joined: Tue Feb 08, 2022 11:43 pm

Re: ES3.Load working on unity but not working on the windows build

Post by Ogirdorsoul »

Just to give an update:
I successfully made a simple scene with similar save structure and the windows build worked! Then I tried/reviewed my code a million times and still dont understand why is not working. I updated the unity and took out the encrypt funcionality and gained some information. As far as I understood when you save the reference for the prefab you cant put your save on another build because the reference there is different thus causing conflits. I was trying something like this (but this is not the original cause of trouble because I cant even start a new party on the windows build as I can on the Unity build).
Anyway as I cant have this problem with saves between different games not exchanging... I'm working now on a workaround that doesnt envolve saving the prefab, I will save some kind of ID for recovering it latter (not the best case, because if latter in development if I want the spells to have upgrades this workaround would be a nightmare but Oh well...).
Thanks for your time
Post Reply