{"id":21906645,"url":"https://github.com/enlight/klawr","last_synced_at":"2025-04-16T00:23:14.262Z","repository":{"id":18685871,"uuid":"21895441","full_name":"enlight/klawr","owner":"enlight","description":"A set of Unreal Engine 4 plugins that enable the use of C# (and other CLI languages) in game projects targeting the Windows platform.","archived":false,"fork":false,"pushed_at":"2015-11-29T19:56:13.000Z","size":478,"stargazers_count":83,"open_issues_count":31,"forks_count":21,"subscribers_count":21,"default_branch":"master","last_synced_at":"2023-03-11T01:05:32.187Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enlight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-16T09:59:03.000Z","updated_at":"2023-01-03T15:15:10.000Z","dependencies_parsed_at":"2022-09-11T16:11:46.620Z","dependency_job_id":null,"html_url":"https://github.com/enlight/klawr","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Fklawr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Fklawr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Fklawr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Fklawr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enlight","download_url":"https://codeload.github.com/enlight/klawr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226955068,"owners_count":17708906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T16:53:59.638Z","updated_at":"2024-11-28T16:54:02.904Z","avatar_url":"https://github.com/enlight.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Klawr (Experimental WIP)\n========================\nA set of Unreal Engine 4 plugins that will allow users to write game-play code in C# (and eventually\nother CLI languages such as F#), in game projects targeting the Windows platform. If you're looking\nfor a cross-platform alternative Xamarin has developed a [plugin](https://mono-ue.github.io/) that\nprovides Mono integration, however a commercial Mono license is not cheap, and it doesn't work in\nnewer UE versions. The primary aim of this project is to make it possible to do anything that can\ncurrently be done in Blueprints in C# scripts, in order to eliminate the need for complex Blueprint\nspaghetti.\n\nThe current development focus is on script components (see `UKlawrScriptComponent`), these are\nactor components whose functionality is implemented in a C# class. The C# class attached to a\nscript component can access any Blueprint accessible property or function exposed by the actor it\nis attached to or any of its sibling components (this is still limited at present since only a\nsubset of all the possible property types is supported). Eventually the properties and methods\ndefined in a C# script component will also be exposed to Blueprints.\n\nSome time was also spent developing script objects, which allow for \"subclassing\" in C# of almost\nany `UObject` derived class, actors included, but that's currently on the back-burner.\n\nNOTE: This project is still highly experimental, and not very useful (though it's getting there).\n\nCheck the [Wiki](https://github.com/enlight/klawr/wiki) for additional details.\n\nPrerequisites\n=============\n- Windows 7 or later\n- Unreal Engine 4.10 or later (you'll need the source from GitHub)\n- Visual Studio 2015\n- .NET Framework 4.5.2 or later\n\nOverview\n========\nKlawr consists of one native C++ library, a couple of C# assemblies, and three UE4 plugins.\n\nThe core of the CLR hosting code is located in the **Klawr.ClrHost** libraries. The\n**Klawr.ClrHost.Native** C++ library bootstraps the CLR, and the C# assemblies handle hosting\nrelated tasks and provide some core classes for use by the auto-generated UE4 C# API (as well\nas user scripts). **Klawr.ClrHost.Native** is linked into **KlawrRuntimePlugin**, which allows\nUnreal Engine to load and execute assemblies containing managed code.\n\n**KlawrCodeGeneratorPlugin** generates C# wrappers for `UObject` subclasses from the reflection\ninformation gathered by the **Unreal Header Tool (UHT)** from `UFUNCTION` and `UPROPERTY`\ndecorators in the engine/game source. This is the same reflection information that underpins much\nof the functionality provided by Blueprints.\n\n**KlawrRuntimePlugin** executes user scripts written in C#, scripts have access to the wrapped UE4\nAPI generated by **KlawrCodeGeneratorPlugin**.\n\n**KlawrEditorPlugin** provides a new Blueprint type that can be used to create actor components\nthat are implemented in managed assemblies.\n\nBuilding\n========\nThis is a two phase process, in the first phase the CLR hosting libraries must be built, in the\nsecond phase the plugins themselves.\n\nSource Location\n---------------\nThe directory hierarchy of this repository matches that of the UE4 source repository, once you\ncheck out this project you can just copy the Engine directory into your UE4 source checkout and\neverything should end up in the right place. However, if you plan on making any changes to the\nsource you'll probably want create a couple of directory junctions instead of copy/pasting\nfiles back and forth. To that end I've provided `CreateLinks.bat`, which you can right-click\non and `Run as administrator` directly from the checkout root. The batch file will prompt you\nto enter the path to the UE4 source checkout that you'd like to use to build Klawr, and will then\ncreate the necessary directory junctions.\n\nNow everything should be in the right place, from here on any paths are relative to the UE4 source\ncheckout.\n\nCustomizing the Unreal Header Tool\n----------------------------------\nTo ensure that the Klawr code generator plugin is built before UHT is executed you'll need to\nmodify `Engine/Source/Programs/UnrealHeaderTool/UnrealHeaderTool.Target.cs` in the engine source.\nA patch file (`UnrealHeaderToolPatch.diff`) with the relevant one-line change is provided in this\nrepository. However, since it is a one-liner you may find it quicker to make the change by hand,\nall you have to do is replace the following line in `UnrealHeaderTool.Target.cs`\n\n``` cpp\nAdditionalPlugins.Add(\"ScriptGeneratorPlugin\");\n```\n\nwith\n\n``` cpp\nAdditionalPlugins.Add(\"KlawrCodeGeneratorPlugin\");\n```\n\nLibraries\n---------\n1. Open `Engine\\Source\\ThirdParty\\Klawr\\Klawr.ClrHost.sln` in VS2015.\n2. Set the `Solution Configuration` to either `Release` or `Debug`.\n3. Set the `Solution Platform` to `x64` (this is very important, Win32 builds are not supported yet).\n4. Select `Build Solution` to build all the libraries.\n\nAssuming that the build finished with no errors you can move on to phase two.\n\nPlugins\n-------\n1. Configure UHT to use the Klawr code generator plugin, to do so add/edit the `Plugins` section in\n   `Engine\\Programs\\UnrealHeaderTool\\Saved\\Config\\Windows\\Engine.ini` (if the file doesn't exist,\n   create it):\n   \n    ```\n    [Plugins]\n    ProgramEnabledPlugins=KlawrCodeGeneratorPlugin\n    ScriptExcludedModules=ScriptPlugin\n    ScriptExcludedModules=ScriptEditorPlugin\n    ScriptExcludedModules=ScriptGeneratorPlugin\n    ScriptExcludedModules=KlawrRuntimePlugin\n    ScriptSupportedModules=CoreUObject\n    ScriptSupportedModules=Engine\n    ```\n2. Run `GenerateProjectFiles.bat` in your UE4 source checkout.\n3. Open `UE4.sln` in VS2015.\n4. Set the `Solution Configuration` to `Debug Editor` or `Development Editor`.\n5. Set the `Solution Platform` to `Win64` (this is very important, Win32 builds are not supported yet).\n6. Select `Build Solution` to build everything.\n\nDuring the build you may see a bunch of console windows popup briefly, don't panic, this is just\nthe Klawr code generator plugin building the UE4 C# wrappers assembly. The wrappers assembly can be\nrebuilt manually by running `Engine\\Intermediate\\ProjectFiles\\Klawr\\Build.bat` from the console.\n\nUsing\n=====\nFirst of all make sure you've got a project open that you don't mind obliterating in case something\ngoes wrong, next enable KlawrRuntimePlugin and KlawrEditorPlugin in UnrealEd, restart as requested.\n\nNow you can [create a script component Blueprint](https://github.com/enlight/klawr/wiki/Creating-a-Script-Component-Blueprint).\n\nLicense\n=======\nKlawr is licensed under the MIT license.\n\nKlawr uses the [pugixml](http://pugixml.org/) library to parse XML, it was written by\nArseny Kapoulkine and is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenlight%2Fklawr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenlight%2Fklawr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenlight%2Fklawr/lists"}