SkookumScript UE4 Plugin Basic Tutorial 1
Click here to download the tutorial project.
Create a new UE4 project that uses Starter Content.
Select the First-person template.
In the UE4 Editor Content browser, navigate to Geometry/Meshes. Right-click 1M_Cube > Asset Actions > Create Blueprint Using This.
Name your new Blueprint
You now have a Blueprint that holds a static mesh of a cube. You may apply a material to the cube so it’s more visible (M_ColorGrid_LowSpec is a good choice), but this is completely optional.
Select the StaticMesh component.
Under Physics, turn off Enable Gravity.
Save and compile
BP_Cube. (Note that the SkookumIDE will also auto-compile).
BP_Cube class will appear in the SkookumIDE Classes widget.
In the UE4 Content browser, navigate to Blueprints and drag our cube into the world somewhere. Make sure it’s nice and visible.
Save your current level.
In the toolbar of the
BP_Cubewindow, click the [Sk] (Show in IDE) button. This will take us to the
BP_Cubeclass in the SkookumIDE Classes widget.
Ensure sure the class is highlighted and click New Class or Member at the bottom of the Members widget. (If a “Skookify your project?” confirmation message appears, click OK.)
The New Class or Member pane is used to add subclasses, coroutines, data members, and methods to our highlighted class. In this case we will create a constructor method.
In the New Class or Member pane, create a constructor by typing
!and pressing Enter.
Now create a coroutine by typing
_rotateand clicking Add.
_rotate coroutine will display in an Editor widget. This is where we’ll put our code for rotating the cube. (We could have just added the code to the constructor itself, but it’s a good rule of thumb to keep constructors brief and tidy).
- Now we’ll add the code for rotating the cube. In the
_rotateEditor widget, paste in the following code:
() [ loop [ !r : RotationAngles!yaw_pitch_roll(100.0 * GameLib.world_delta_seconds 0.0 0.0) add_actor_world_rotation(r) _wait //wait until the next frame before executing this loop again ] ]
- Now we’ll call our coroutine from inside our constructor. Select
!and paste in the following code:
() [ branch [_rotate] ]
Learn more about the
branch command here.
Press F7 to compile.
Run the project, and voilà! Behold a rotating cube!