After building my project, JsonConvert.DefaultSettings is not set upon startup by this package. It works fine in the editor but, probably due to my project layout, the initialization doesn't work properly in builds. This is fine, I don't care, but I would like to be able to use the default config myself. So, instead of relying on JsonConvert.DefaultSettings, I would like to manually pass UnityConverterInitializer.defaultUnityConvertersSettings to the json calls I'm making.
Motivation
Unfortunately, it seems UnityConverterInitializer.defaultUnityConvertersSettings is inaccessible because UnityConverterInitializer is an internal class. I have the option of manually creating a JsonSerializerSettings, but I just want the default settings from this package, without having to worry about misconfiguring it or updating it for future releases of this package. I can access UnityConverterInitializer.defaultUnityConvertersSettings using reflection, but that is not very nice.
Suggested solution
Either make UnityConverterInitializer public, or create a new public type that exposes defaultUnityConvertersSettings or CreateJsonSettingsWithFreslyLoadedConfig()
Hi @Wouterdek, thanks for the great suggestion! I did not really realize that it's marked as internal. In my mind I coded it in a way so it would be possible to alter it via code as well.
Description
After building my project,
JsonConvert.DefaultSettings
is not set upon startup by this package. It works fine in the editor but, probably due to my project layout, the initialization doesn't work properly in builds. This is fine, I don't care, but I would like to be able to use the default config myself. So, instead of relying onJsonConvert.DefaultSettings
, I would like to manually passUnityConverterInitializer.defaultUnityConvertersSettings
to the json calls I'm making.Motivation
Unfortunately, it seems
UnityConverterInitializer.defaultUnityConvertersSettings
is inaccessible becauseUnityConverterInitializer
is an internal class. I have the option of manually creating aJsonSerializerSettings
, but I just want the default settings from this package, without having to worry about misconfiguring it or updating it for future releases of this package. I can accessUnityConverterInitializer.defaultUnityConvertersSettings
using reflection, but that is not very nice.Suggested solution
Either make
UnityConverterInitializer
public, or create a new public type that exposesdefaultUnityConvertersSettings
orCreateJsonSettingsWithFreslyLoadedConfig()
Thank you!