Closed rubendariohh closed 1 year ago
Interesting. Did Unity start including Newtonsoft.Json into the Editor? That's cool.
Can you delete the Assets/JsonDotNet folder in the project? Do the errors go away after you do this? If yes - done.
If not - install the asset from scratch from the asset store: https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347 If it's resolved - nice. If not - what's the Build Target in BuildSettings?
Also - check this out: https://stackoverflow.com/questions/64321053/unity-multiple-precompiled-assemblies-with-the-same-name-using-external-dll
HI, thanks for the quick response, I'm eager to test your project.
I deleted the folder and the error message disappeared, but when trying to generate the map it seems there are missing references from the deleted folder.
I will install the project from the Unity Asset Store, thanks!
[image: image.png]
On Thu, Jun 10, 2021 at 3:36 PM Vladimir Limarchenko < @.***> wrote:
Interesting. Did Unity start including Newtonsoft.Json into the Editor? That's cool.
Can you delete the Assets/JsonDotNet folder in the project? Do the errors go away after you do this? If yes - done.
If not - install the asset from scratch from the asset store: [ https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347](Json.Net on the Asset Store) If it's resolved - nice. If not - what's the Build Target in BuildSettings?
Also - check this out: [ https://stackoverflow.com/questions/64321053/unity-multiple-precompiled-assemblies-with-the-same-name-using-external-dll](Similar issue discussed on StackOverflow)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/silverua/slay-the-spire-map-in-unity/issues/14#issuecomment-859040826, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARQBJ52II5HFORCYJ4UR3OLTSEO5NANCNFSM46PIMYGA .
With the latest asset and any 2020.3.x LTS I was also seeing a Self referencing loop detected with type 'normalized'
That got fixed by changing Map.cs ToJson() and setting up ReferenceLoopHandling.Ignore alongside formatting. Likely SaveMap() in MapManager.cs needs this fix as well, as it needs to be there whenever running a JsonConvert.SerializeObject(Map).
public string ToJson()
{
return JsonConvert.SerializeObject(this, new JsonSerializerSettings()
{
Formatting = Formatting.Indented,
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
});
}
With the latest asset and any 2020.3.x LTS I was also seeing a Self referencing loop detected with type 'normalized'
That got fixed by changing Map.cs ToJson() and setting up ReferenceLoopHandling.Ignore alongside formatting. Likely SaveMap() in MapManager.cs needs this fix as well, as it needs to be there whenever running a JsonConvert.SerializeObject(Map).
public string ToJson() { return JsonConvert.SerializeObject(this, new JsonSerializerSettings() { Formatting = Formatting.Indented, ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); }
Im getting this issue too. I implimented your fix in map.cs, how do i fix it in the rest for the rest of the scripts?
Here's how to do it in MapManager.cs in SaveMap(). It successfully ran after I made the edit below.
public void SaveMap()
{
if (CurrentMap == null) return;
var json = JsonConvert.SerializeObject(CurrentMap, new JsonSerializerSettings()
{
Formatting = Formatting.Indented,
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
});
PlayerPrefs.SetString("Map", json);
PlayerPrefs.Save();
}
in 2022.2.1 i implemented the changes by @Allenjxwang and @Jishin85 to resolve my self referencing loop errors.
I've upgraded to Unity 2021 on the master branch. This issue should now be resolved.
I got an error message when trying to open the project with the last Unity version: Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included or the current platform. Only one assembly with the same name is allowed per platform.