{"id":2524,"date":"2026-05-15T11:49:59","date_gmt":"2026-05-15T02:49:59","guid":{"rendered":"https:\/\/blue-water.pgw.jp\/wordpress\/?p=2524"},"modified":"2026-05-15T11:49:59","modified_gmt":"2026-05-15T02:49:59","slug":"unity%e3%81%a7mcp%e3%83%84%e3%83%bc%e3%83%ab%e3%81%8c%e3%80%8c%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e5%90%8d%e3%81%8c%e9%95%b7%e3%81%99%e3%81%8e%e3%81%be%e3%81%99%e3%80%8d%e3%82%a8%e3%83%a9%e3%83%bc","status":"publish","type":"post","link":"https:\/\/blue-water.pgw.jp\/wordpress\/2026\/05\/15\/unity%e3%81%a7mcp%e3%83%84%e3%83%bc%e3%83%ab%e3%81%8c%e3%80%8c%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e5%90%8d%e3%81%8c%e9%95%b7%e3%81%99%e3%81%8e%e3%81%be%e3%81%99%e3%80%8d%e3%82%a8%e3%83%a9%e3%83%bc\/","title":{"rendered":"Unity\u3067MCP\u30c4\u30fc\u30eb\u304c\u300c\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u9577\u3059\u304e\u307e\u3059\u300d\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u6642\u306e\u89e3\u6c7a\u7b56"},"content":{"rendered":"<h1 style=\"font-size: 2em; font-weight: 900; line-height: 1.3; border-left: 6px solid #e74c3c; padding-left: 0.6em; margin-bottom: 1em;\"><\/h1>\n<p>Unity \u306eMCP\uff08\u30e2\u30c7\u30eb\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30d7\u30ed\u30c8\u30b3\u30eb\uff09\u30c4\u30fc\u30eb\u3092\u4f7f\u3063\u3066C#\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u969b\u306b\u3001\u3053\u3093\u306a\u30a8\u30e9\u30fc\u304c\u51fa\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre><code>Error running mono.exe: \u30d5\u30a1\u30a4\u30eb\u540d\u307e\u305f\u306f\u62e1\u5f35\u5b50\u304c\u9577\u3059\u304e\u307e\u3059\u3002<\/code><\/pre>\n<h2>\u306a\u305c\u3053\u306e\u30a8\u30e9\u30fc\u304c\u8d77\u304d\u308b\u306e\u304b<\/h2>\n<p>Unity\u306eMCP\u30c4\u30fc\u30eb\u306f\u3001\u901a\u5e38\u300cCodeDom\u300d\u3068\u3044\u3046\u4ed5\u7d44\u307f\u3067C#\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u307e\u3059\u3002\u3053\u306eCodeDom\u306f\u3001\u30b3\u30fc\u30c9\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u969b\u306bWindows\u4e0a\u3067<code>mono.exe<\/code>\u3068\u3044\u3046\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8d77\u52d5\u3057\u307e\u3059\u304c\u3001\u305d\u306e\u6642\u306b\u4f7f\u7528\u3059\u308b\u30a2\u30bb\u30f3\u30d6\u30ea\uff08DLL\uff09\u306e\u30d1\u30b9\u60c5\u5831\u3092\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u3067\u6e21\u3057\u307e\u3059\u3002<\/p>\n<p>Unity\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u591a\u304f\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3044\u308b\u3068\u3001\u3053\u308c\u3089\u306e\u30d1\u30b9\u60c5\u5831\u304c\u5408\u8a08\u3067\u9577\u304f\u306a\u308a\u3059\u304e\u3066\u3001Windows \u304c\u8a31\u53ef\u3057\u3066\u3044\u308b\u6587\u5b57\u6570\u306e\u5236\u9650\uff08260\u6587\u5b57\uff09\u3092\u8d85\u3048\u3066\u3057\u307e\u3044\u3001\u30a8\u30e9\u30fc\u306b\u306a\u308b\u306e\u3067\u3059\u3002<\/p>\n<h2>\u89e3\u6c7a\u7b56\uff1aRoslyn \u3092\u4f7f\u3046<\/h2>\n<p>CodeDom \u306e\u4ee3\u308f\u308a\u306b\u300cRoslyn\u300d\uff08\u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8\u306e\u516c\u5f0f\u306aC#\u30b3\u30f3\u30d1\u30a4\u30e9\uff09\u3092\u30e1\u30e2\u30ea\u5185\u3067\u76f4\u63a5\u52d5\u304b\u3059\u3053\u3068\u3067\u3001\u3053\u306e\u554f\u984c\u3092\u56de\u907f\u3067\u304d\u307e\u3059\u3002\u5e78\u3044\u306a\u3053\u3068\u306b\u3001Unity\u306b\u306f\u65e2\u306bRoslyn\u304c\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u6709\u52b9\u5316\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<h2>\u5b9f\u88c5\u65b9\u6cd5<\/h2>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092 <code>Assets\/Editor\/RoslynLoader.cs<\/code> \u3068\u3057\u3066\u4fdd\u5b58\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><code>[InitializeOnLoad]\r\nstatic class RoslynLoader\r\n{\r\n    static RoslynLoader()\r\n    {\r\n        var editorData = Path.GetDirectoryName(UnityEditor.EditorApplication.applicationPath);\r\n        var roslynDir = Path.Combine(editorData, \"Data\", \"MonoBleedingEdge\", \"lib\",\r\n                                     \"mono\", \"msbuild\", \"Current\", \"bin\", \"Roslyn\");\r\n\r\n        var dlls = new[]\r\n        {\r\n            \"System.Collections.Immutable.dll\",\r\n            \"Microsoft.CodeAnalysis.dll\",\r\n            \"Microsoft.CodeAnalysis.CSharp.dll\",\r\n        };\r\n\r\n        foreach (var dll in dlls)\r\n            if (File.Exists(Path.Combine(roslynDir, dll)))\r\n                Assembly.LoadFrom(Path.Combine(roslynDir, dll));\r\n    }\r\n}<\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306fUnity\u306e\u8d77\u52d5\u6642\u306b\u81ea\u52d5\u5b9f\u884c\u3055\u308c\u3001Roslyn\u306eDLL\u30d5\u30a1\u30a4\u30eb\u3092\u30e1\u30e2\u30ea\u306b\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<code>[InitializeOnLoad]<\/code>\u5c5e\u6027\u306b\u3088\u308a\u3001Unity\u304c\u8d77\u52d5\u3059\u308b\u305f\u3073\u306b\u81ea\u52d5\u7684\u306b\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>\u78ba\u8a8d\u65b9\u6cd5<\/h2>\n<p>\u5b9f\u88c5\u5f8c\u3001MCP\u30c4\u30fc\u30eb\u3067\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><code>return System.Type.GetType(\r\n    \"Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree, Microsoft.CodeAnalysis.CSharp\"\r\n) != null ? \"Roslyn\u6709\u52b9\" : \"\u672a\u30ed\u30fc\u30c9\";<\/code><\/pre>\n<p>\u300cRoslyn\u6709\u52b9\u300d\u3068\u8868\u793a\u3055\u308c\u308c\u3070\u6210\u529f\u3067\u3059\u3002\u3053\u308c\u3067\u9577\u3044\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u306e\u554f\u984c\u304c\u89e3\u6d88\u3055\u308c\u3001\u30a8\u30e9\u30fc\u306a\u304f\u30b3\u30fc\u30c9\u304c\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"ad\"><a href=\"https:\/\/px.a8.net\/svt\/ejp?a8mat=3BDS3D+DXWFQQ+447K+HZI6P\" rel=\"nofollow\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www26.a8.net\/svt\/bgt?aid=200517241843&amp;wid=001&amp;eno=01&amp;mid=s00000019208003021000&amp;mc=1\" alt=\"\" width=\"300\" height=\"250\" border=\"0\" \/><\/a><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www13.a8.net\/0.gif?a8mat=3BDS3D+DXWFQQ+447K+HZI6P\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" \/><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Unity\u306eMCP\u30c4\u30fc\u30eb\u3067\u767a\u751f\u3059\u308b\u300c\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u9577\u3059\u304e\u307e\u3059\u300d\u30a8\u30e9\u30fc\u3092Roslyn\u3067\u89e3\u6c7a\u3059\u308b\u65b9\u6cd5\u3092\u89e3\u8aac\u3002<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[27],"tags":[197,196,199,195,198],"class_list":["post-2524","post","type-post","status-publish","format-standard","hentry","category-pc","tag-c","tag-mcp","tag-roslyn","tag-unity","tag-198"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blue-water.pgw.jp\/wordpress\/wp-json\/wp\/v2\/posts\/2524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blue-water.pgw.jp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue-water.pgw.jp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue-water.pgw.jp\/wordpress\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/blue-water.pgw.jp\/wordpress\/wp-json\/wp\/v2\/comments?post=2524"}],"version-history":[{"count":2,"href":"https:\/\/blue-water.pgw.jp\/wordpress\/wp-json\/wp\/v2\/posts\/2524\/revisions"}],"predecessor-version":[{"id":2527,"href":"https:\/\/blue-water.pgw.jp\/wordpress\/wp-json\/wp\/v2\/posts\/2524\/revisions\/2527"}],"wp:attachment":[{"href":"https:\/\/blue-water.pgw.jp\/wordpress\/wp-json\/wp\/v2\/media?parent=2524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue-water.pgw.jp\/wordpress\/wp-json\/wp\/v2\/categories?post=2524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue-water.pgw.jp\/wordpress\/wp-json\/wp\/v2\/tags?post=2524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}