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

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.  Today we are looking at the open source USharp extension, which is based on the MonoUE plugin project.  Using this plugin, UE4 gains C# functionality with the following features:

  • 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.
  • Access to Unreal’s reflection system (UClass, UFunction, UProperty, etc).
  • Hot-reload
  • Dynamically switch between .NET Framework, .NET Core and Mono for an improved debugging / runtime experience without having to reopen the editor
  • Supports Windows, Mac and Linux

There are however some downsides:

  • This project depends on a lot of PInvoked functions which could potentially behave differently on different C++ compilers. This project may not work on some target platforms.
  • 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.
  • The weaved IL currently seems to break edit-and-continue debugging (issue with cecil?)
  • 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).

If you are interested in checking out USharp, you can find the installation instructions here.  One potential problem to be aware of, the project creator doesn’t seem to have attached a license to the code repository!  While this code is not production ready, if you intend to use it in any capacity, I would make sure the license is suitable.  See the results of the plugin in action in the video below.

GameDev News


Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  PowerIK For Unreal Engine Hands-On xSicKxBot 0 1,704 09-06-2023, 12:15 PM
Last Post: xSicKxBot
  Unreal Engine As A 3D Modeling & Sculpting Application xSicKxBot 0 1,700 09-03-2023, 09:49 AM
Last Post: xSicKxBot
  Unreal Engine As A 3D Modeling & Sculpting Application xSicKxBot 0 2,062 12-21-2020, 10:40 PM
Last Post: xSicKxBot
  Unreal Engine 4.26 Released xSicKxBot 0 1,638 12-06-2020, 09:21 PM
Last Post: xSicKxBot
  Unreal Engine Asset Giveaway For December 2020 xSicKxBot 0 1,566 12-02-2020, 01:15 AM
Last Post: xSicKxBot
  NVIDIA Release RTX Branch of Unreal Engine 4.25.4 xSicKxBot 0 1,625 11-09-2020, 08:06 PM
Last Post: xSicKxBot
  Unreal Engine Free Content for November 2020 xSicKxBot 0 1,540 11-03-2020, 04:03 PM
Last Post: xSicKxBot
  Unreal Engine 4.26 Water Simulation xSicKxBot 0 1,491 10-16-2020, 07:29 PM
Last Post: xSicKxBot
  Unreal Engine Marketplace Giveaway for October 2020 xSicKxBot 0 1,611 10-06-2020, 01:29 PM
Last Post: xSicKxBot
  Unreal Engine 4.26 Preview 1 Released xSicKxBot 0 1,649 09-25-2020, 04:51 PM
Last Post: xSicKxBot

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016