How to set up a UE4 C++ project to work with SkookumScript


#1

Making your C++ project work with SkookumScript (i.e. how to use UCLASS, UFUNCTION. UPROPERTY and UENUM macros in your own C++ code and have the reflected types appear in SkookumScript) requires making a few modifications to some source and build files. Follow this guide and you should have it working in no time.

  1. Please download the FireBot sample project from our downloads page. It is an example C++ project that uses SkookumScript, and we will use it as a reference.
  2. Start by creating a new file named SkookumScript.ini in your project’s Config folder. We recommend you copy it from the FireBot project and modify it. In SkookumScript.ini, you specify (repeat several times to specify multiple items of the same kind)
  • +ScriptSupportedModules to tell SkookumScript for which module to generate bindings (this is usually just one module - your main game module)
  • +AdditionalIncludes to specify additional include files to include to make the binding code work (this is sometimes necessary as UE4 header files very often do not include all necessary sub-includes and will simply not compile unless used in a “magic order” which is hard to get perfect)
  • +SkipClasses to specify the name of classes or structs that you do not want to reflect to SkookumScript
  • +RenameClasses and +RenameProperties to resolve name conflicts when mapping UE4 Blueprints to SkookumScript code (see here for details)
  1. Important: In UE 4.15 and below, whenever you make changes to SkookumScript.ini, you need to Clean UnrealHeaderTool (or temporarily add a blank line to any header file containing UCLASS or UFUNCTION macros) to pick up the changes. In UE 4.16 and above, the build system automatically detects the changes and triggers the appropriate build steps.
  2. In your game module main cpp file (usually named YourGame.cpp) add the following include file:
    #include <SkUEProjectGeneratedBindings.generated.inl>
  3. In your game module’s MyGame.Build.cs script file
    • add the following imports to the top of the file: using System.IO; using System.Collections.Generic; using Tools.DotNETCommon;
    • add the following code to the constructor:
      PrivateDependencyModuleNames.AddRange(GetSkookumScriptModuleNames(Path.Combine(ModuleDirectory, "../..")));
    • add the definition of the function GetSkookumScriptModuleNames() itself (see the FireBot sample project’s FireBot.Build.cs file for an example)
  4. If you are using UE 4.15 or below, Clean UnrealHeaderTool (or temporarily add a blank line to any header file containing UCLASS or UFUNCTION macros) to manually trigger a re-run of UnrealHeaderTool
  5. Build your game project

This should be all that’s needed for you to start using UCLASS(), UFUNCTION() etc. macros and see the respective SkookumScript classes appear in the IDE!

Hope this helps! Don’t hesitate to let us know if you have any more questions.


BlueprintPure functions
3.0.4462 is here! Lots of stability improvements and easier C++ project setup
Sub-Includes
Working with other plugins?
UStructs not showing in IDE
Failed moving project information from temporary to editable location
About Automated tests using SK
Read the SkookumScript Primer to level up!
[Resolved] Not seeing raw data members in ShooterGame base project
Docs for 3rd party plugins
Great curated posts to learn about SkookumScript
[Solved] Mixed Versioning between Source/Binary engine/plugin? Project vs Engine plugin?
Trying To Call Custom Functions on Custom Pawn From C++
#2

Thank you for this guide! I had come across :sk: earlier this year and liked what I saw, but struggled getting it working with a c++ project and left it for the time.

But with your updates since then and this post, it’s all good now and I’m really liking it so far. Great to see all the support you guys provide in the forums too.

[@Noolarch: Moved note about possible missing script files error to - "Missing script bindings for 4.13.2]


#3

For the build.cs instructions, you need to include the following assemblies at the top of the file:

using System.IO;
using System.Collections.Generic;


#4

I’ve been banging my head against a wall trying to follow old instructions. I found this tutorial today and I think that I’m on the right track, but now I’m getting a weird error in VS.

Missing binary: C:\Users\Matt\Documents\Unreal Projects\Testing\Plugins\SkookumScript\Binaries\Win64\UnrealHeaderTool-SkookumScriptGenerator.dll

I installed the Skookumscript plugin from the market place and it is in my UE4.15 Engine/Plugins folder. Why is it still trying to find the .dll in my project?

Edit: It looks like my real problem is that Paper2D is not supported by default. I’m now getting this error in VS:

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol “__declspec(dllimport) public: static class SkClass * __cdecl SkUEPaperTileInfo::get_class(void)” (_imp?get_class@SkUEPaperTileInfo@@SAPEAVSkClass@@XZ) referenced in function “void __cdecl SkUETestingWorldGenerator_Impl::mthd_paper_tile_info_for_tile(class SkInvokedMethod *,class SkInstance * *)” (?mthd_paper_tile_info_for_tile@SkUETestingWorldGenerator_Impl@@YAXPEAVSkInvokedMethod@@PEAPEAVSkInstance@@@Z) Testing C:\Users\Matt\Documents\Unreal Projects\Testing\Intermediate\ProjectFiles\Testing.cpp.obj 1


#5

With the GitHub version of SkookumScript you can enable Paper2D by adding Paper2D to the +ScriptSupportedModules list in Config/SkookumScript.ini of the plugin, then rebuild, after which the class would be available for use in :sk:.

If you don’t want to make the leap to build from GitHub source, we will see if there is a workaround for the launcher+Marketplace builds and will give updated instructions as soon we have the details.


#6

It would be helpful to explain how the string should look like for this when you have 2+ includes you want to add. Do you call the parameter multiple times? Or use a comma-separated list? Is the variable quotes-encapsulated? Etc.

The Firebot project doesn’t use this so it’s not helpful.


#7

In Step 5, you also need to add:

using Tools.DotNETCommon;