static CustomScriptAssemblyReference LoadCustomScriptAssemblyReferenceFromJson(string path, string json) { try { var customScriptAssemblyRefData = CustomScriptAssemblyReferenceData.FromJson(json); return(CustomScriptAssemblyReference.FromCustomScriptAssemblyReferenceData(path, customScriptAssemblyRefData)); } catch (Exception e) { throw new AssemblyDefinitionException(e.Message, path); } }
public static CustomScriptAssemblyReferenceData FromJson(string json) { CustomScriptAssemblyReferenceData assemblyRefData = new CustomScriptAssemblyReferenceData(); UnityEngine.JsonUtility.FromJsonOverwrite(json, assemblyRefData); if (assemblyRefData == null) { throw new Exception("Json file does not contain an assembly reference definition"); } return(assemblyRefData); }
} // Name or GUID public static CustomScriptAssemblyReference FromCustomScriptAssemblyReferenceData(string path, CustomScriptAssemblyReferenceData customScriptAssemblyReferenceData) { if (customScriptAssemblyReferenceData == null) { return(null); } var pathPrefix = path.Substring(0, path.Length - AssetPath.GetFileName(path).Length); var customScriptAssemblyReference = new CustomScriptAssemblyReference(); customScriptAssemblyReference.FilePath = path; customScriptAssemblyReference.PathPrefix = pathPrefix; customScriptAssemblyReference.Reference = customScriptAssemblyReferenceData.reference; return(customScriptAssemblyReference); }
public static string ToJson(CustomScriptAssemblyReferenceData data) { return(UnityEngine.JsonUtility.ToJson(data, true)); }