-
Notifications
You must be signed in to change notification settings - Fork 6
Getting Started
Follow instructions on the official Unreal Engine site to set up Unreal Engine 4.
This library has been tested to work with Unreal Engine 4.12 on Windows and OS X. It may work with earlier versions of UE4, too, as long as you don't use features added in recent versions. Notice that the library intentionally doesn't provide wrappers for deprecated methods and fields.
-
Compile or download Nim for your platform as described at https://github.com/nim-lang/Nim/. Nim v0.14.0 or newer is required.
-
Visual Studio Code is the recommended environment for working with Nim code. Install VSCode by following the instructions on the website, then install
nim
extension by bringing up the command palette (ctrl-shift-p
), selectingInstall Extension
and typingnim
. Also, installc#
extension to work with C# code (UE4 build files). -
Clone this repository into a folder of your choice:
git clone https://github.com/pragmagic/nimue4.git
-
Create a new C++ project using the Unreal Editor.
-
Copy files from
nimue4/stubs/
folder into the project's root folder. -
Open the project's root folder in VSCode (
File
->Open Folder
). -
Delete all the generated
.h
and.cpp
files from Source folder. -
Change paths to nimue4 and Nim inside
build.cmd
andbuild.sh
files. If on Windows, change path to Visual Studio, if necessary. -
Change
nim.project
setting inside.vscode/settings.json
to match your project name. For example, if the project is calledMyGame
, set it toIntermediate/Nim/MyGameRoot.nim
. -
Add these lines to the game module's build rules constructor (
MyGame.Build.cs
):var moduleDir = this.ModuleDirectory; PrivateIncludePaths.Add(Path.Combine(Environment.GetEnvironmentVariable("NIM_HOME"), "lib")); PublicIncludePaths.Add(Path.Combine(moduleDir, ".nimgen", "Public")); PrivateIncludePaths.Add(Path.Combine(moduleDir, ".nimgen", "Private")); UEBuildConfiguration.bForceEnableExceptions = true;
-
These imports also have to be added at the top of the
Build.cs
file:using System; using System.IO;
-
Add these lines to
Config/DefaultEngine.ini
(changeMyGame
to your project's name):[/Script/Engine.Engine] GameEngine=/Script/MyGame.NimGameEngine
-
From now on, press
ctrl+shift+B
(cmd+shift+B
on OS X) in VSCode to compile and deploy your code.