概要
brew install terminal-notifier
上記のコマンドで terminal-notifier をインストールしておく。
using System.Diagnostics; using UnityEditor; internal static class Example { [MenuItem( "Tools/Example" )] private static void Run() { // `which terminal-notifier` コマンドで取得したパスを設定 var fileName = "/opt/homebrew/bin/terminal-notifier"; var title = "ピカチュウ"; var message = "カイリュー"; var arguments = $@"-title ""{title}"" -message ""{message}"""; var startInfo = new ProcessStartInfo { FileName = fileName, Arguments = arguments, RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false, CreateNoWindow = true }; var process = new Process { StartInfo = startInfo }; process.Start(); process.WaitForExit(); } }