コード例 #1
0
        public void Import(ScriptableObject scriptableObject)
        {
            if (this.settings == null)
            {
                return;
            }

            string file = ImportExportHelper.PersistentPath(scriptableObject.name + ".json");

            if (this.settings.CustomDirectory)
            {
                string source = ImportExportHelper.AbsolutePath(this.settings.DirectoryPath, scriptableObject.name + ".json");
                ImportExportHelper.CopyFile(source, file);
            }

            if (ImportExportHelper.ExistsFile(file))
            {
                string json = ImportExportHelper.ImportFile(file);
                JsonUtility.FromJsonOverwrite(json, scriptableObject);
                LogNow(ImportExportLogType.Import, scriptableObject);
            }
            else
            {
                Export(scriptableObject);
            }
        }
コード例 #2
0
        public void ImportManually(ScriptableObject scriptableObject, string file)
        {
            string json = ImportExportHelper.ImportFile(file);

            JsonUtility.FromJsonOverwrite(json, scriptableObject);
            LogNow(ImportExportLogType.ImportManually, scriptableObject);
            WriteLogAndClear();
        }