Skip to content

Exception is thrown if lilToonSetting.json is empty #385

@BuIlDaLiBlE

Description

@BuIlDaLiBlE

For some reason my lilToonSetting.json file was empty and did not contain anything, and an exception was thrown from lilToon. Deleting the file made it generate with proper values which fixed the issue, but this should be handled automatically by lilToon.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: JSON parse error: The document is empty.
  at (wrapper managed-to-native) UnityEngine.JsonUtility.FromJsonInternal(string,object,System.Type)
  at UnityEngine.JsonUtility.FromJsonOverwrite (System.String json, System.Object objectToOverwrite) [0x00059] in <87781e9b12134dbc9598174129a79531>:0 
  at lilToonSetting.LoadShaderSetting (lilToonSetting& shaderSetting) [0x0001f] in .\Packages\jp.lilxyzw.liltoon\Editor\lilToonSetting.cs:218 
  at lilToonSetting.InitializeShaderSetting (lilToonSetting& shaderSetting) [0x0000b] in .\Packages\jp.lilxyzw.liltoon\Editor\lilToonSetting.cs:225 
  at lilToon.lilStartup.lilStartupMethod () [0x0005d] in .\Packages\jp.lilxyzw.liltoon\Editor\lilStartup.cs:73 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <27124aa0e30a41659b903b822b959bc7>:0 
   --- End of inner exception stack trace ---
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <27124aa0e30a41659b903b822b959bc7>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <27124aa0e30a41659b903b822b959bc7>:0 
  at UnityEditor.EditorAssemblies.ProcessInitializeOnLoadMethodAttributes () [0x000a5] in <80a8ce1980c648dca8e68f0d8aa3b930>:0 
UnityEngine.Logger:Log (UnityEngine.LogType,object)
(wrapper dynamic-method) UnityEngine.Debug:UnityEngine.Debug.LogError_Patch1 (object)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions