↩️ Back
In order to properly load *.json files you must follow these rules first
Your *.json file must be located inside a folder that is named the same way as your type of data you want to deserialize
You must refrence your BepInEx dll file using Zip Configuration's pluginDllPath key, so ModExtraAssets knows where to grab the data type from.
Your *.json file entry must have a metadata pair where the key is meaJsonType and the value is the full type name (w/ namespace, if any)
You must refrence your BepInEx dll file using Vfp Configuration's pluginDllPath key, so ModExtraAssets knows where to grab the data type from.
By default, ModExtraAssets uses UnityEngine.JsonUtility.ToJson<T>() to deserialize your data, but that's actually very customizable!
Example: Loading database with using Newtonsoft.Json library
SomeProcedureType proc = Blayms.MEA.ModExtraAssets.CreateLoadingProcedure<SomeProcedureType>(@"D:\mypluginfolder\procedureRequired.file", this,
(string json, Type type, object[] extraData) =>
{
return JsonConvert.DeserializeObject(json, type, (JsonSerializerSettings)extraData[0]);
}, new object[]{MyCoolClass.GetJsonSerializerSettingsFor<LocalizationData>()});
proc.Initiate();
extraData[0] - JsonSerializerSettings from the object[] below