Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using C# With Unreal Engine

#1
Using C# With Unreal Engine

<div><p>While Unreal Engine doesn’t provide C# support out of the box, it does provide an exceptional plugin system, so it was only a matter of time until C# plugins arrived.&nbsp; Today we are looking at the open source <a href="https://github.com/pixeltris/USharp">USharp extension</a>, which is based on the <a href="https://mono-ue.github.io/">MonoUE plugin</a> project.&nbsp; Using this plugin, UE4 gains C# functionality with the following features:</p>
<blockquote>
<ul>
<li>Write C# using UObject exposed types (AActor, AGameMode, UActorComponent, etc). Define new UObject types and inherit existing ones. Exposed C# types can then be used in (or extended by) Blueprint. </li>
<li>Access to <a href="https://www.unrealengine.com/en-US/blog/unreal-property-system-reflection">Unreal’s reflection system</a> (UClass, UFunction, UProperty, etc). </li>
<li>Hot-reload </li>
<li>Dynamically switch between .NET Framework, .NET Core and Mono for an improved debugging / runtime experience without having to reopen the editor </li>
<li>Supports Windows, Mac and Linux </li>
</ul>
</blockquote>
<p>There are however some downsides:</p>
<blockquote>
<ul>
<li>This project depends on a lot of PInvoked functions which could potentially behave differently on different C++ compilers. <strong>This project may not work on some target platforms.</strong></li>
<li>Like mono-ue this project depends on lots of generated code and IL weaving. It probably isn’t the best for performance and there is a huge amount of generated code everywhere. </li>
<li>The weaved IL currently seems to break edit-and-continue debugging (issue with cecil?) </li>
<li>There is currently too much marshaling on structs / collections (list, map, set). Marshaling needs to be redesigned to avoid copies of entire collections / structs on trivial calls between C# / native code. Additionally marshaling of delegates needs to be redesigned (various issues such as being referenced as a copy of the delegate). </li>
</ul>
</blockquote>
<p>If you are interested in checking out USharp, you can find the installation instructions <a href="https://github.com/pixeltris/USharp/wiki/Plugin-Setup">here</a>.&nbsp; One potential problem to be aware of, the project creator doesn’t seem to have attached a license to the code repository!&nbsp; While this code is not production ready, if you intend to use it in any capacity, I would make sure the license is suitable.&nbsp; See the results of the plugin in action in the video below.</p>
<p align="center"><iframe class='youtube-player' type='text/html' width='853' height='480' src='https://www.youtube.com/embed/sc4Odx_gbVE?version=3&rel=1&fs=1&autohide=2&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<p class="under"> <span class="categories"><a href="https://www.gamefromscratch.com/category/GameDev-News.aspx">GameDev News</a></span> <span class="tags"><a href="https://www.gamefromscratch.com/?tag=/Unreal" rel="tag">Unreal</a> <a href="https://www.gamefromscratch.com/?tag=/C%23" rel="tag">C#</a></span> </p>
<hr>
</div>
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016