How to access and use C++ API from the SkookumScript plugin

I want to call methods inside a C++ class created inside my project from SkookumScript. The C++ class is created from Unreal Editor. I couldn’t find a way to access it from the SkookumIDE. I know this is possible with SkookumScript I just want to know how to achieve that. Thanks :slight_smile:

I’ve had this on my list of TODOs. I’ll finish up the new set of instructions on how to do this later today.

1 Like

You can now find instructions in the repo readme under C++ Project Instructions. If you are using 4.24 be sure to grab the latest release or source, there were a few fixes to SkookumScriptGenerator that are required if you’re doing C++ stuff.

1 Like

Thank you so much for the reply. I followed your instructions and I have this error showing up.

Error E1696 cannot open source file “SkUEProjectGeneratedBindings.generated.inl”

I’ve tried this on UE 4.18.3 and 4.23.1

Can you show me your project’s build.cs file, your SkookumScript config file and your main project cpp.

Is this the binary or source engine? If binary did you clean project and rebuild. If source did you try cleaning the UnrealHeaderTool program and rebuilding.

Finally do you have the SkookumScript plugin enabled in the project file?

This is Binary Engine. I even tried re doing this in 4.24. still the same problem. I checked and inside
C:\Users<username>\Documents\Unreal Projects\SkCpp\Plugins\SkookumScript\Intermediate\Build\Win64\UE4Editor\Inc\SkookumScriptRuntime I couldn’t find SkUEProjectGeneratedBindings.generated.inl

If you’d like further help then please respond with the items I asked for.

buildcs skookumScriptini sourcefile

Sorry I forgot to attach these with the comment. Please have a look at them. :slight_smile:

EDIT: I’m not sure if you can see Build.cs file properly :confused:

1 Like

I can see it fine, just open in new tab. Ok your files check out. Since you are using the binary engine can you try cleaning the project and recompiling.

The SkUEProjectGeneratedBindings.generated.inl file is generated by UnrealHeaderTool (UHT) during the build process, but unless you clean your project, UHT doesn’t run.

When you build you should first see UHT being built. Then you’ll see UHT run with a message like:

Running UnrealHeaderTool …
SkookumScript: Generating C++ script bindings for 39 engine modules and 1 project module(s)

If it still doesn’t work, send over the build output, there might be some errors occurring during UHT.

1 Like

I did clean the project and then built it. Still the problem exists. :confused:
Here is the output log.

1

2

I see a complaint about PCHUsage not being specified, can you uncomment the line in your build.cs file:
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

The main problem I see here is that it isn’t trying to generate your project bindings. The main reason this would happen is if the SkookumScript.ini file were missing. Can you verify the location of this file? It should be in the Config folder of your project where the other ini files are.

1 Like

Thats it. :slight_smile: Even though I created the SkookumScript.ini file from VS it wasn’t really added to the config folder. I tried manually adding it to the config folder inside the project and now it works. My bad! Thank you for your time and support. :slight_smile:

1 Like

Hey again!. Is there any example projects where SkookumScript has been used with C++ classes and methods? All the classes, functions and Properties are now showing but when I call them nothing happens. :confused:

There aren’t any, however all of the existing stock functions are defined in C++. So even calling some_actor.actor_location is calling the C++ GetActorLocation().

Can you give me some example code that you’re trying? Maybe I can spot an issue.

Its really simple. I created two Actors using c++ and blueprints in unreal editor. Then I added a simple function to the c++ actor using VS. And added UFunction() and stuff. I can see both actors in SkookumIDE and I wrote a simple script to continuously rotate the actor. I added same script to the c++ actor but nothing actually happens. I can see the function I defined before. but couldn’t call it.

This is the BPMyActor. It has a coroutine which can rotate the actor.

bp code

I call it inside the constructor.

bp code condtructor

I did the same thing for C++ MyActor. Nothing happens.

cactor

Not even print to the log.

log

this is the c++ code of the MyActor.

ddd

ff

This looks mostly legit. One thing to mention is that :sk: only executes at runtime. So you would need to drag one of these actors into a level and simulate or play to see the code run.

I would recommend defining an entry point method that you call from blueprint begin play like:

&blueprint
()
[
 branch _transform
]

The reason being that class constructors are called often when the game world doesn’t exist and trying to call certain methods during this time can result in a crash.

You should definitely see your print statements when you simulate with one of these actors in the level.