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

Commit

Permalink
Merge pull request #4 from jnakanojp/macOS
Browse files Browse the repository at this point in the history
for macOS
  • Loading branch information
baba-s authored Apr 23, 2019
2 parents 3b6f350 + 11d945a commit 9a21675
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
23 changes: 19 additions & 4 deletions Assets/UnityCompileInBackground/Editor/UnityCompileInBackground.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ private static void Init()
// ファイル監視ツールを起動します
// ツールからメッセージを受信したらコンパイルを開始します
var dataPath = Application.dataPath;
var filename = dataPath + "/" + CONSOLE_APP_PATH;
var path = Application.dataPath;
#if UNITY_EDITOR_OSX
var filename = "/usr/local/bin/fswatch";
#else
var filename = dataPath + "/" + CONSOLE_APP_PATH;
#endif
var path = Application.dataPath;
#if UNITY_EDITOR_OSX
var arguments = string.Format(@"-x ""{0}""", path);
#else
var arguments = string.Format( @"-p ""{0}"" -w 0", path );
var windowStyle = ProcessWindowStyle.Hidden;
#endif
var windowStyle = ProcessWindowStyle.Hidden;

var info = new ProcessStartInfo
{
Expand Down Expand Up @@ -124,11 +132,18 @@ private static void OnReceived( object sender, DataReceivedEventArgs e )
//
// この関数では AssetDatabase.Refresh を呼び出しても何も起きないので
// フラグだけ立てておいて Refresh は EditorApplication.update で行います
#if UNITY_EDITOR_OSX
if (message.Contains("Created") || message.Contains("Renamed") || message.Contains("Updated") || message.Contains("Removed"))
{
m_isRefresh = true;
}
#else
if ( message.Contains( "OnChanged" ) || message.Contains( "OnRenamed" ) )
{
m_isRefresh = true;
}
}
#endif
}
}
}

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ You can start compiling without having to return focus to the Unity editor after

For example, if you edit and save the code in Visual Studio,
compilation will start without returning to the Unity editor.

For macOS user, please run "brew install fswatch".

0 comments on commit 9a21675

Please sign in to comment.