Skip to content
This repository was archived by the owner on Apr 19, 2020. It is now read-only.

Commit 9a21675

Browse files
authored
Merge pull request #4 from jnakanojp/macOS
for macOS
2 parents 3b6f350 + 11d945a commit 9a21675

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

Assets/UnityCompileInBackground/Editor/UnityCompileInBackground.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,18 @@ private static void Init()
3333
// ファイル監視ツールを起動します
3434
// ツールからメッセージを受信したらコンパイルを開始します
3535
var dataPath = Application.dataPath;
36-
var filename = dataPath + "/" + CONSOLE_APP_PATH;
37-
var path = Application.dataPath;
36+
#if UNITY_EDITOR_OSX
37+
var filename = "/usr/local/bin/fswatch";
38+
#else
39+
var filename = dataPath + "/" + CONSOLE_APP_PATH;
40+
#endif
41+
var path = Application.dataPath;
42+
#if UNITY_EDITOR_OSX
43+
var arguments = string.Format(@"-x ""{0}""", path);
44+
#else
3845
var arguments = string.Format( @"-p ""{0}"" -w 0", path );
39-
var windowStyle = ProcessWindowStyle.Hidden;
46+
#endif
47+
var windowStyle = ProcessWindowStyle.Hidden;
4048

4149
var info = new ProcessStartInfo
4250
{
@@ -124,11 +132,18 @@ private static void OnReceived( object sender, DataReceivedEventArgs e )
124132
//
125133
// この関数では AssetDatabase.Refresh を呼び出しても何も起きないので
126134
// フラグだけ立てておいて Refresh は EditorApplication.update で行います
135+
#if UNITY_EDITOR_OSX
136+
if (message.Contains("Created") || message.Contains("Renamed") || message.Contains("Updated") || message.Contains("Removed"))
137+
{
138+
m_isRefresh = true;
139+
}
140+
#else
127141
if ( message.Contains( "OnChanged" ) || message.Contains( "OnRenamed" ) )
128142
{
129143
m_isRefresh = true;
130144
}
131-
}
145+
#endif
146+
}
132147
}
133148
}
134149

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ You can start compiling without having to return focus to the Unity editor after
1818

1919
For example, if you edit and save the code in Visual Studio,
2020
compilation will start without returning to the Unity editor.
21+
22+
For macOS user, please run "brew install fswatch".

0 commit comments

Comments
 (0)