├── .gitignore
├── CHANGELOG.md
├── CHANGELOG.md.meta
├── Documentation~
└── README_EN.md
├── Editor.meta
├── Editor
├── Scripts.meta
├── Scripts
│ ├── Binary2TextExec.cs
│ ├── Binary2TextExec.cs.meta
│ ├── Binary2TextExecWindow.cs
│ ├── Binary2TextExecWindow.cs.meta
│ ├── DiffExec.cs
│ ├── DiffExec.cs.meta
│ ├── EditorToolExec.cs
│ ├── EditorToolExec.cs.meta
│ ├── McsExec.cs
│ ├── McsExec.cs.meta
│ ├── Pdb2mdbExec.cs
│ ├── Pdb2mdbExec.cs.meta
│ ├── WebExtractExec.cs
│ ├── WebExtractExec.cs.meta
│ ├── WebExtractExecWindow.cs
│ └── WebExtractExecWindow.cs.meta
├── UTJ.UnityCommandLineTools.Editor.asmdef
└── UTJ.UnityCommandLineTools.Editor.asmdef.meta
├── LICENSE
├── LICENSE.meta
├── README.md
├── README.md.meta
├── package.json
└── package.json.meta
/.gitignore:
--------------------------------------------------------------------------------
1 | # This .gitignore file should be placed at the root of your Unity project directory
2 | #
3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
4 | #
5 | /[Ll]ibrary/
6 | /[Tt]emp/
7 | /[Oo]bj/
8 | /[Bb]uild/
9 | /[Bb]uilds/
10 | /[Ll]ogs/
11 | /[Mm]emoryCaptures/
12 |
13 | # Asset meta data should only be ignored when the corresponding asset is also ignored
14 | !/[Aa]ssets/**/*.meta
15 |
16 | # Uncomment this line if you wish to ignore the asset store tools plugin
17 | # /[Aa]ssets/AssetStoreTools*
18 |
19 | # Autogenerated Jetbrains Rider plugin
20 | [Aa]ssets/Plugins/Editor/JetBrains*
21 |
22 | # Visual Studio cache directory
23 | .vs/
24 |
25 | # Gradle cache directory
26 | .gradle/
27 |
28 | # Autogenerated VS/MD/Consulo solution and project files
29 | ExportedObj/
30 | .consulo/
31 | *.csproj
32 | *.unityproj
33 | *.sln
34 | *.suo
35 | *.tmp
36 | *.user
37 | *.userprefs
38 | *.pidb
39 | *.booproj
40 | *.svd
41 | *.pdb
42 | *.mdb
43 | *.opendb
44 | *.VC.db
45 |
46 | # Unity3D generated meta files
47 | *.pidb.meta
48 | *.pdb.meta
49 | *.mdb.meta
50 |
51 | # Unity3D generated file on crash reports
52 | sysinfo.txt
53 |
54 | # Builds
55 | *.apk
56 | *.unitypackage
57 |
58 | # Crashlytics generated file
59 | crashlytics-build.properties
60 |
61 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## [0.1.1] - 2022-08-31
4 |
5 | - [Change]コマンドライン実行時にコンソールウィンドを開かないように変更
6 |
7 | ## [0.1.0] - 2021-10-14
8 |
9 | - 1st Release
10 |
--------------------------------------------------------------------------------
/CHANGELOG.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: db02a4477c595a6448c05055002ac62f
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Documentation~/README_EN.md:
--------------------------------------------------------------------------------
1 | # UnityCommandLineTools
2 | 
3 |
4 | Control the CommandLineTool in Unity from a script.
5 |
6 | ## Summary
7 |
8 | Allows you to execute various command line tools that are in Unity Editor from a script.
9 | An Editor extension is provided as a sample.
10 |
11 | ## Supported Tools
12 |
13 | - WebExtract
14 | - binary2text
15 | - diff
16 | - mcs
17 | - pdb2mdp
18 |
--------------------------------------------------------------------------------
/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 751ed5fb34e7da442be03a59cd3d0312
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eab474f4492204a4c95ce66126ed06f7
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/Scripts/Binary2TextExec.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | #if UNITY_EDITOR
6 | namespace UTJ.UnityCommandLineTools
7 | {
8 | //
9 | // bin2textをUnityEditorから実行する為のClass
10 | // programed by Katsumasa.Kimura
11 | //
12 | public class Binary2TextExec : EditorToolExec
13 | {
14 | public Binary2TextExec() : base("binary2text*") { }
15 |
16 | //
17 | // bin2text filePath outPath options
18 | // /summary>
19 | public int Exec(string filePath,string outPath,string options)
20 | {
21 | var args = string.Format(@"""{0}"" ""{1}"" {2}", filePath, outPath, options);
22 | return Exec(args);
23 | }
24 | }
25 | }
26 | #endif
27 |
--------------------------------------------------------------------------------
/Editor/Scripts/Binary2TextExec.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2ea7805f56fa6c44fa405f2a86ff45d3
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/Scripts/Binary2TextExecWindow.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 | using UTJ.UnityCommandLineTools;
6 |
7 | [System.Serializable]
8 | public class Binary2TextExecWindow : EditorWindow
9 | {
10 | static class Styles
11 | {
12 | public static GUIContent Src = new GUIContent("Open Binary","binary file");
13 | public static GUIContent Dest = new GUIContent("Save As","text file");
14 | public static GUIContent Option = new GUIContent("Option");
15 | public static GUIContent Detailed = new GUIContent("Detailed");
16 | public static GUIContent LargeBinaryHashOnly = new GUIContent("LargeBinaryHashOnly");
17 | public static GUIContent HexFloat = new GUIContent("HexFloat");
18 | public static readonly GUIContent SaveContents = new GUIContent((Texture2D)EditorGUIUtility.Load("d_OpenedFolder Icon"), "Set Save Location");
19 |
20 | }
21 |
22 | [SerializeField] string mBinaryFilePath = "";
23 | [SerializeField] string mTextFilePath = "";
24 | [SerializeField] bool mIsDetailed;
25 | [SerializeField] bool mIsLargeBinaryHashOnly;
26 | [SerializeField] bool mIsHexfloat;
27 |
28 |
29 | [MenuItem("Window/UTJ/UnityCommanLineTools/Binary2Text")]
30 | static void Init()
31 | {
32 | var window = (Binary2TextExecWindow)EditorWindow.GetWindow(typeof(Binary2TextExecWindow));
33 | window.Show();
34 | }
35 |
36 |
37 | private void OnGUI()
38 | {
39 |
40 | EditorGUILayout.BeginHorizontal();
41 | {
42 | GUIContent content;
43 | Vector2 contentSize;
44 |
45 | contentSize = EditorStyles.label.CalcSize(Styles.Src);
46 | if(GUILayout.Button(Styles.Src, GUILayout.MaxWidth(contentSize.x + 10))){
47 | mBinaryFilePath = EditorUtility.OpenFilePanel("Select binary file", "", "");
48 | }
49 | //contentSize = EditorStyles.label.CalcSize(Styles.Src);
50 | //EditorGUILayout.LabelField(Styles.Src, GUILayout.MaxWidth(contentSize.x + 10));
51 | content = new GUIContent(mBinaryFilePath);
52 | contentSize = EditorStyles.label.CalcSize(content);
53 | EditorGUILayout.LabelField(new GUIContent(mBinaryFilePath), GUILayout.Width(contentSize.x + 10));
54 | GUILayout.FlexibleSpace();
55 | }
56 | EditorGUILayout.EndHorizontal();
57 |
58 | EditorGUILayout.BeginHorizontal();
59 | {
60 | GUIContent content;
61 | Vector2 contentSize;
62 |
63 | contentSize = EditorStyles.label.CalcSize(Styles.Dest);
64 | if (GUILayout.Button(Styles.Dest, GUILayout.MaxWidth(contentSize.x + 10)))
65 | {
66 | string defaultName = "";
67 | if(string.IsNullOrEmpty(mBinaryFilePath) == false)
68 | {
69 | defaultName = System.IO.Path.GetFileNameWithoutExtension(mBinaryFilePath) + ".txt";
70 | }
71 |
72 |
73 | mTextFilePath = EditorUtility.SaveFilePanel(
74 | "Save texture as PNG",
75 | "",
76 | defaultName,
77 | "txt");
78 | }
79 | //contentSize = EditorStyles.label.CalcSize(Styles.Src);
80 | //EditorGUILayout.LabelField(Styles.Dest, GUILayout.MaxWidth(contentSize.x + 10));
81 | content = new GUIContent(mTextFilePath);
82 | contentSize = EditorStyles.label.CalcSize(content);
83 | EditorGUILayout.LabelField(new GUIContent(mTextFilePath), GUILayout.Width(contentSize.x + 10));
84 | GUILayout.FlexibleSpace();
85 | }
86 | EditorGUILayout.EndHorizontal();
87 |
88 |
89 | EditorGUILayout.LabelField(Styles.Option);
90 | using (new EditorGUI.IndentLevelScope())
91 | {
92 | mIsDetailed = EditorGUILayout.ToggleLeft(Styles.Detailed, mIsDetailed);
93 | mIsLargeBinaryHashOnly = EditorGUILayout.ToggleLeft(Styles.LargeBinaryHashOnly, mIsLargeBinaryHashOnly);
94 | mIsHexfloat = EditorGUILayout.ToggleLeft(Styles.HexFloat, mIsHexfloat);
95 | }
96 |
97 | EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty( mTextFilePath) || string.IsNullOrEmpty(mBinaryFilePath));
98 | {
99 | if (GUILayout.Button("Done"))
100 | {
101 | var bin2exec = new Binary2TextExec();
102 |
103 | string options = "";
104 | if (mIsDetailed)
105 | {
106 | options += " -detailed";
107 | }
108 | if (mIsLargeBinaryHashOnly)
109 | {
110 | options += " -largebinaryhashonly";
111 | }
112 | if (mIsHexfloat)
113 | {
114 | options += " -hexfloat";
115 | }
116 |
117 | var result = bin2exec.Exec(mBinaryFilePath, mTextFilePath, options);
118 | EditorUtility.DisplayDialog(result == 0 ? "Success" : "Fail", bin2exec.output,"OK");
119 | }
120 | }
121 | EditorGUI.EndDisabledGroup();
122 |
123 | }
124 |
125 |
126 | }
127 |
--------------------------------------------------------------------------------
/Editor/Scripts/Binary2TextExecWindow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 196497f68894e974faae2080dcadd66b
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/Scripts/DiffExec.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 |
6 | #if UNITY_EDITOR
7 | namespace UTJ.UnityCommandLineTools
8 | {
9 | //
10 | // diffをUnityEditorから実行する為のClass
11 | // programed by Katsumasa.Kimura
12 | //
13 | public class DiffExec : EditorToolExec
14 | {
15 | //
16 | // コンストラクタ
17 | //
18 | public DiffExec() : base("diff*") { }
19 |
20 | //
21 | // diffを実行する
22 | //
23 | // filePath1 : ファイルへのパス
24 | // filePath2 : ファイルへのパス
25 | // options : diffに渡すオプション
26 | //
27 | // 正常時 : 0
28 | // 異常時 : 1,2
29 | //
30 | //
31 | public int Exec(string filePath1,string filePath2,string options = null)
32 | {
33 | string args;
34 | if (string.IsNullOrEmpty(options))
35 | {
36 | args = string.Format(@"""{0}"" ""{1}", filePath1, filePath2);
37 | }
38 | else
39 | {
40 | args = string.Format(@"""{2}"" ""{0}"" {1}", filePath1, filePath2, options);
41 | }
42 | return Exec(args);
43 | }
44 | }
45 | }
46 | #endif
--------------------------------------------------------------------------------
/Editor/Scripts/DiffExec.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ff42da16749f8d44ea42074c02f16094
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/Scripts/EditorToolExec.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System;
6 | using UnityEditor;
7 | using UnityEngine;
8 |
9 | #if UNITY_EDITOR
10 |
11 | namespace UTJ.UnityCommandLineTools
12 | {
13 | //
14 | // UnityEditorに含まれるコマンドラインツールを実行する為の基底Class
15 | // programed by Katsumasa.Kimura
16 | //
17 | public class EditorToolExec
18 | {
19 | //
20 | // UnityEditorがインストールされているディレクトリへのパス
21 | //
22 | protected string mEditorPath;
23 |
24 | //
25 | // Toolsディレクトリへのパス
26 | //
27 | protected string mToolsPath;
28 |
29 | //
30 | // 実行ファイル名
31 | //
32 | protected string mExecFname;
33 |
34 | //
35 | // 実行ファイルへのフルパス
36 | //
37 | protected string mExecFullPath;
38 |
39 | //
40 | // 実行結果のOUTPUT
41 | //
42 | private string mOutput;
43 |
44 | //
45 | // 実行結果のOUTPUT
46 | //
47 | public string output
48 | {
49 | get { return mOutput; }
50 | }
51 |
52 | //
53 | // コンストラクタ
54 | //
55 | // mExecFname : 実行ファイル名
56 | //
57 | // /summary>
58 | public EditorToolExec(string mExecFname)
59 | {
60 | mEditorPath = Path.GetDirectoryName(EditorApplication.applicationPath);
61 | mToolsPath = Path.Combine(mEditorPath, @"Data/Tools");
62 | this.mExecFname = mExecFname;
63 | //var files = Directory.GetFiles(mToolsPath, mExecFname, SearchOption.AllDirectories);
64 | var files = Directory.GetFiles(mEditorPath, mExecFname+"*", SearchOption.AllDirectories);
65 | mExecFullPath = files[0];
66 | }
67 |
68 | //
69 | // コマンドラインツールを実行する
70 | //
71 | // arg : コマンドラインツールに渡す引数
72 | //
73 | //
74 | public int Exec(string arg)
75 | {
76 | int exitCode = -1;
77 |
78 | try
79 | {
80 | using (var process = new Process())
81 | {
82 | process.StartInfo.FileName = mExecFullPath;
83 | process.StartInfo.Arguments = arg;
84 | process.StartInfo.UseShellExecute = false;
85 | process.StartInfo.RedirectStandardOutput = true;
86 | process.StartInfo.CreateNoWindow = true;
87 | process.Start();
88 | mOutput = process.StandardOutput.ReadToEnd();
89 | process.WaitForExit();
90 | exitCode = process.ExitCode;
91 | process.Close();
92 | }
93 | }
94 | catch (Exception e)
95 | {
96 | UnityEngine.Debug.Log(e);
97 | }
98 | return exitCode;
99 | }
100 | }
101 | }
102 | #endif
--------------------------------------------------------------------------------
/Editor/Scripts/EditorToolExec.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4e5c5086f3235dd4496c9a1bab96d76d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/Scripts/McsExec.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using UnityEngine;
5 |
6 | #if UNITY_EDITOR
7 | namespace UTJ.UnityCommandLineTools
8 | {
9 | //
10 | // コマンドラインツールを使用してDLLを作成する
11 | // Programed by Katsumasa.Kimura
12 | //
13 | public class McsExec : EditorToolExec
14 | {
15 | public McsExec() : base(
16 | #if UNITY_EDITOR_WIN
17 | "mcs.bat"
18 | #else
19 | "mcs"
20 | #endif
21 | ) { }
22 |
23 | //
24 | // DLLを作成する
25 | // UnityEngine.dllを含める
26 | // UnityEditor.dllを含める
27 | // 出力するDLLのファイル名
29 | // C#のファイル名の配列
30 | // 実行結果 0:正常時 その他:異常時
31 | //
32 | public int Exec(
33 | bool isUseUnityEngineDll,
34 | bool isUseUnityEditorDll,
35 | bool isDebug,
36 | string dllName,
37 | string[] srcNames
38 | )
39 | {
40 | string args = "";
41 |
42 | if (isUseUnityEngineDll)
43 | {
44 | var path = "UnityEngine.dll";
45 | var files = Directory.GetFiles(mEditorPath, path, SearchOption.AllDirectories);
46 | args += " -r:\"" + files[0] + "\"";
47 | }
48 | if (isUseUnityEditorDll)
49 | {
50 | var path ="UnityEditor.dll";
51 | var files = Directory.GetFiles(mEditorPath, path, SearchOption.AllDirectories);
52 | args += " -r:\"" + files[0] + "\"";
53 | }
54 | args += " -target:library -out:" + dllName;
55 |
56 | if (isDebug)
57 | {
58 | args += " -debug";
59 | }
60 |
61 | foreach(var srcName in srcNames)
62 | {
63 | args += " " + srcName;
64 | }
65 |
66 | return base.Exec(args);
67 | }
68 |
69 | }
70 | }
71 | #endif
--------------------------------------------------------------------------------
/Editor/Scripts/McsExec.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6fe0e926aac4bce4ea951e6f9c9b1fd9
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/Scripts/Pdb2mdbExec.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 |
6 |
7 | #if UNITY_EDITOR
8 | namespace UTJ.UnityCommandLineTools
9 | {
10 | //
11 | // pdb2mdbをUnityEditorから実行する為のClass
12 | // programed by Katsumasa.Kimura
13 | //
14 | public class Pdb2mdbExec : EditorToolExec
15 | {
16 | public Pdb2mdbExec() : base("pdb2mdb*") { }
17 |
18 | }
19 | }
20 | #endif
--------------------------------------------------------------------------------
/Editor/Scripts/Pdb2mdbExec.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: df6ca2e51ac890c4b8253b655093fe8d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/Scripts/WebExtractExec.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 |
6 | #if UNITY_EDITOR
7 | namespace UTJ.UnityCommandLineTools
8 | {
9 | //
10 | // bin2textをUnityEditorから実行する為のClass
11 | // programed by Katsumasa.Kimura
12 | //
13 | public class WebExtractExec : EditorToolExec
14 | {
15 | public WebExtractExec() : base("WebExtract*") { }
16 | }
17 | }
18 | #endif
--------------------------------------------------------------------------------
/Editor/Scripts/WebExtractExec.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 914820ffec9f5f846a2f4e1a33cb1631
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/Scripts/WebExtractExecWindow.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 | using UTJ.UnityCommandLineTools;
6 |
7 | [System.Serializable]
8 | public class WebExtractExecWindow : EditorWindow
9 | {
10 | static class Styles
11 | {
12 | public static GUIContent Src = new GUIContent("Open Binary", "open binary file");
13 | public static readonly GUIContent SaveContents = new GUIContent((Texture2D)EditorGUIUtility.Load("d_OpenedFolder Icon"), "Set Save Location");
14 | }
15 |
16 | [SerializeField] string mBinaryFilePath = "";
17 | [MenuItem("Window/UTJ/UnityCommanLineTools/WebExtractExec")]
18 | static void Init()
19 | {
20 | var window = (WebExtractExecWindow)EditorWindow.GetWindow(typeof(WebExtractExecWindow));
21 | window.Show();
22 | }
23 |
24 | private void OnGUI()
25 | {
26 |
27 | EditorGUILayout.BeginHorizontal();
28 | {
29 | GUIContent content;
30 | Vector2 contentSize;
31 |
32 | contentSize = EditorStyles.label.CalcSize(Styles.Src);
33 | if (GUILayout.Button(Styles.Src, GUILayout.MaxWidth(contentSize.x + 10)))
34 | {
35 | mBinaryFilePath = EditorUtility.OpenFilePanel("Select binary file", "", "");
36 | }
37 | //contentSize = EditorStyles.label.CalcSize(Styles.Src);
38 | //EditorGUILayout.LabelField(Styles.Src, GUILayout.MaxWidth(contentSize.x + 10));
39 | content = new GUIContent(mBinaryFilePath);
40 | contentSize = EditorStyles.label.CalcSize(content);
41 | EditorGUILayout.LabelField(new GUIContent(mBinaryFilePath), GUILayout.Width(contentSize.x + 10));
42 | GUILayout.FlexibleSpace();
43 | }
44 | EditorGUILayout.EndHorizontal();
45 |
46 |
47 |
48 | EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(mBinaryFilePath));
49 | {
50 | if (GUILayout.Button("Done"))
51 | {
52 | var bin2exec = new WebExtractExec();
53 | var result = bin2exec.Exec(mBinaryFilePath);
54 | EditorUtility.DisplayDialog(result == 0 ? "Success" : "Fail", bin2exec.output, "OK");
55 | }
56 | }
57 | EditorGUI.EndDisabledGroup();
58 |
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/Editor/Scripts/WebExtractExecWindow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 17de7edfb160a20468e36c85bcef2a6e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/UTJ.UnityCommandLineTools.Editor.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "UTJ.UnityCommandLineTools.Editor",
3 | "references": [],
4 | "includePlatforms": [
5 | "Editor"
6 | ],
7 | "excludePlatforms": [],
8 | "allowUnsafeCode": false,
9 | "overrideReferences": false,
10 | "precompiledReferences": [],
11 | "autoReferenced": true,
12 | "defineConstraints": [],
13 | "versionDefines": [],
14 | "noEngineReferences": false
15 | }
--------------------------------------------------------------------------------
/Editor/UTJ.UnityCommandLineTools.Editor.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 60d6489e9615bff45b5ef22bb8f4d0ca
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Katsumasa
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/LICENSE.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 34e874c8a1d27004dba5ab5689a2e673
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UnityCommandLineTools
2 | 
3 |
4 | Unityに同梱されているCommandLineToolをスクリプトから制御する
5 |
6 | ## 概要
7 |
8 | UnityEditorに同梱されている各種コマンドラインツールをスクリプト内から実行することが出来ます。
9 | サンプルとしてEditor拡張を用意しています。
10 |
11 | ## 対応済みTools
12 |
13 | - WebExtract
14 | - binary2text
15 | - diff
16 | - mcs
17 | - pdb2mdp
18 |
19 | ## Sampleを使ってAssetBundeの中身を確認してみよう!
20 |
21 | AssetBunldeの中身を確認する為には、大まかに下記の手順となります。
22 |
23 | 1. AssetBunldを展開(WebExtract)
24 | 2. バイナリファイルを人間が読めるTextファイルへ変換する(binarry2text)
25 |
26 | ### AssetBundleを展開する
27 |
28 | 1. Window > UTJ > UnityCommandLineTools > WebExtractを選択する
29 |
30 | 
31 |
32 | 2. Open Binaryボタンを押して、目的のAssetBundleファイルを選択する
33 |
34 | 
35 |
36 | 3. Doneボタンを押してAssetBundleを展開します。
37 | AssetBundleと同じフォルダーに{AssetBundle名}_dataというフォルダが作成され、そのフォルダー内にCAB-Hash値というファイル名のバイナリファイルが作成されます。
38 |
39 | 
40 |
41 |
42 | ### バイナリファイルをテキストファイルへ変換する
43 |
44 | 1. Window > UTJ > UnityCommandLineTools > binary2Textを選択する
45 | 2. Open Binaryで展開されたAssetBundle(CAB-Hash値)ファイルを選択する
46 | 3. Save Asでテキストファイルの出力先を選択する
47 | 4. Doneを押す
48 |
49 | 
50 |
51 |
52 | ClassIDに関しては[こちら](https://docs.unity3d.com/ja/current/Manual/ClassIDReference.html)をご確認下さい。
53 | また、[こちら](https://support.unity.com/hc/en-us/articles/217123266-How-do-I-determine-what-is-in-my-Scene-bundle-)の記事がテキストファイルの内容の理解を助けます。
54 |
55 |
56 |
57 | 以上です。
58 |
59 |
--------------------------------------------------------------------------------
/README.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d1aaa27664410d24fa57c3eca06b8b77
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.utj.unitycommandlinetools",
3 | "version": "0.1.1",
4 | "displayName": "UnityCommandLineTools",
5 | "description": "UnityCommandLineTools is a package to control the command line tools included in Unity.",
6 | "unity": "2018.1",
7 | "dependencies": {},
8 | "keywords": [],
9 | "author": {
10 | "name": "Katsumasa.Kimura",
11 | "email": "katsumasa@unity3d.com",
12 | "url": "https://github.com/katsumasa"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6d4df6e424c6eeb4abd2a6d24ce89aeb
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------