Skip to content

Instantly share code, notes, and snippets.

@karljj1
Created May 13, 2025 09:36
Show Gist options
  • Save karljj1/ace07bde835fef2dd85e405141945f2c to your computer and use it in GitHub Desktop.
Save karljj1/ace07bde835fef2dd85e405141945f2c to your computer and use it in GitHub Desktop.
Export an assets data as JSON
using UnityEditor;
public class ExportAsJson
{
[MenuItem("CONTEXT/Object/Export As Json")]
public static void DoExportAsJson(MenuCommand command)
{
var json = EditorJsonUtility.ToJson(command.context, true);
var path = EditorUtility.SaveFilePanel("Save JSON", "", command.context.name + ".json", "json");
if (string.IsNullOrEmpty(path))
return;
System.IO.File.WriteAllText(path, json);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment