{"id":217,"date":"2018-03-12T22:34:17","date_gmt":"2018-03-12T22:34:17","guid":{"rendered":"https:\/\/www.jasonsblog.place\/?p=217"},"modified":"2018-07-25T23:45:10","modified_gmt":"2018-07-25T23:45:10","slug":"how-to-add-c-assemblies-to-a-godot-engine-project","status":"publish","type":"post","link":"https:\/\/www.jasonsblog.place\/index.php\/2018\/03\/12\/how-to-add-c-assemblies-to-a-godot-engine-project\/","title":{"rendered":"How to Add C# Assemblies to a Godot Engine Project"},"content":{"rendered":"<p>With the release of version 3.0 of the <a href=\"https:\/\/www.godotengine.org\">Godot Engine<\/a>, C# was added as a supported programming language. Due to other engines like Unity, there is a large number of C# assemblies which can help in developing a game. However, there isn&#8217;t an easy way to add assemblies in the editor. Therefore, this tutorial was created to help with that problem.<\/p>\n<p>In this tutorial, we&#8217;ll use the Godot Engine, version 3.0, along with the assembly for <a href=\"http:\/\/berkin.me\/rant\/\">Rant<\/a>. Note that while a C# assembly can be added to the editor, the assembly cannot be <em>exported<\/em> to a self-contained executable just yet.<\/p>\n<p><strong>Update<\/strong>: as of version 3.0.5 of the Godot Engine, <a href=\"https:\/\/github.com\/godotengine\/godot\/issues\/15615\">exporting C# projects with assemblies<\/a> have become possible.<\/p>\n<p>1. Create project as normal. Where necessary, add a C# script. At first, the engine will generate the necessary C# files (i.e. the &#8220;*.csproj&#8221; and &#8220;*.sln&#8221; files).<\/p>\n<p><a href=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-218\" src=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot1.png\" alt=\"\" width=\"714\" height=\"562\" srcset=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot1.png 714w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot1-300x236.png 300w\" sizes=\"auto, (max-width: 714px) 100vw, 714px\" \/><\/a><\/p>\n<p>2. Add in the C# code. After this, close the editor for the moment.<a href=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-220\" src=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot3.png\" alt=\"\" width=\"945\" height=\"490\" srcset=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot3.png 945w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot3-300x156.png 300w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot3-768x398.png 768w\" sizes=\"auto, (max-width: 945px) 100vw, 945px\" \/><\/a><\/p>\n<p>3. Ensure that the correct assembly is in the Godot project working directory.<\/p>\n<p><a href=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-221\" src=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot4.png\" alt=\"\" width=\"683\" height=\"463\" srcset=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot4.png 683w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot4-300x203.png 300w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/a><\/p>\n<p>4. Go into a desirable IDE and open up the &#8220;*.csproj&#8221; file which was created when the C# script was added. Monodevelop will be used in this tutorial. At this point, ensure that the Godot editor isn&#8217;t running. Otherwise, key files may be overwritten.<\/p>\n<p><a href=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-222\" src=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot5.png\" alt=\"\" width=\"881\" height=\"540\" srcset=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot5.png 881w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot5-300x184.png 300w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot5-768x471.png 768w\" sizes=\"auto, (max-width: 881px) 100vw, 881px\" \/><\/a><\/p>\n<p>5. In Monodevelop, right-click on the <code>References<\/code> node in the tree view for the project and click on <code>Edit References...<\/code> Be sure to first expand the project so as to reveal <code>References<\/code>. Then click on the <code>.NET assembly<\/code> tab and click &#8220;Browse&#8230;&#8221;.<\/p>\n<p><a href=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-223\" src=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot6.png\" alt=\"\" width=\"1364\" height=\"739\" srcset=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot6.png 1364w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot6-300x163.png 300w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot6-768x416.png 768w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot6-1024x555.png 1024w\" sizes=\"auto, (max-width: 1364px) 100vw, 1364px\" \/><\/a><\/p>\n<p>6. Select the desired assembly for the project and then click &#8220;Open&#8221;.<\/p>\n<p><a href=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-224\" src=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot7.png\" alt=\"\" width=\"1366\" height=\"736\" srcset=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot7.png 1366w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot7-300x162.png 300w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot7-768x414.png 768w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot7-1024x552.png 1024w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<p>7. It should then be added as a reference for the project. Click &#8220;OK&#8221; and save the project (&#8220;Ctrl + S&#8221; or &#8220;File -&gt; Save&#8221;). Exit out of the IDE and go back into the Godot editor.<\/p>\n<p><a href=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-225\" src=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot8.png\" alt=\"\" width=\"889\" height=\"551\" srcset=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot8.png 889w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot8-300x186.png 300w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot8-768x476.png 768w\" sizes=\"auto, (max-width: 889px) 100vw, 889px\" \/><\/a><\/p>\n<p>8. Add in a GDscript which makes use of the assembly.<\/p>\n<p><a href=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-226\" src=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot9.png\" alt=\"\" width=\"943\" height=\"590\" srcset=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot9.png 943w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot9-300x188.png 300w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot9-768x481.png 768w\" sizes=\"auto, (max-width: 943px) 100vw, 943px\" \/><\/a><\/p>\n<p>9. If all goes well, the engine should use the assembly in the resulting game.<\/p>\n<p><a href=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-227\" src=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot10.png\" alt=\"\" width=\"578\" height=\"234\" srcset=\"https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot10.png 578w, https:\/\/www.jasonsblog.place\/wp-content\/uploads\/2018\/03\/shot10-300x121.png 300w\" sizes=\"auto, (max-width: 578px) 100vw, 578px\" \/><\/a><\/p>\n<p>If you have any comments or questions, please ask them below, or <a href=\"https:\/\/www.jasonsblog.place\/index.php\/getting-in-contact-with-me\/\">get in touch with me<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the release of version 3.0 of the Godot Engine, C# was added as a supported programming language. Due to other engines like Unity, there is a large number of C# assemblies which can help in developing a game. However, there isn&#8217;t an easy way to add assemblies in the editor. Therefore, this tutorial was [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,76,31],"tags":[92,55,106,107,91,95,108,54,23],"class_list":["post-217","post","type-post","status-publish","format-standard","hentry","category-fun","category-programming","category-video-games","tag-c","tag-design","tag-game-development","tag-gdscript","tag-godot-engine","tag-mono","tag-monodevelop","tag-programming-languages","tag-video-game"],"_links":{"self":[{"href":"https:\/\/www.jasonsblog.place\/index.php\/wp-json\/wp\/v2\/posts\/217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jasonsblog.place\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jasonsblog.place\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jasonsblog.place\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jasonsblog.place\/index.php\/wp-json\/wp\/v2\/comments?post=217"}],"version-history":[{"count":12,"href":"https:\/\/www.jasonsblog.place\/index.php\/wp-json\/wp\/v2\/posts\/217\/revisions"}],"predecessor-version":[{"id":236,"href":"https:\/\/www.jasonsblog.place\/index.php\/wp-json\/wp\/v2\/posts\/217\/revisions\/236"}],"wp:attachment":[{"href":"https:\/\/www.jasonsblog.place\/index.php\/wp-json\/wp\/v2\/media?parent=217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jasonsblog.place\/index.php\/wp-json\/wp\/v2\/categories?post=217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jasonsblog.place\/index.php\/wp-json\/wp\/v2\/tags?post=217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}