Skip to main content

Create Your First AngelScript Script

In this tutorial you add AngelScript gameplay logic to the project. AngelScript is the current scripting path for gameplay code that benefits from fast iteration.

Prerequisites

Goal

By the end, the project will contain an AngelScript asset that can run in the scene and report a visible result through the editor output or scene behavior.

<IMG: AngelScript asset open in the editor with a small gameplay script>

Enable AngelScript

  1. Open the project plugin settings.
  2. Enable the AngelScript plugin.
  3. Reload the project if the editor asks you to do so.

The plugin provides the runtime script plugin, editor plugin, and editor engine plugin needed to create and run AngelScript assets.

Create a Script Asset

  1. Create a new AngelScript asset in the project data directory.
  2. Give it a clear name, such as FirstGameBehavior.
  3. Open the script asset.
  4. Add a small behavior that can be verified when the scene runs.

For the first script, keep the result obvious: log a message, modify a reflected property, or trigger a simple scene change.

Connect the Script to the Scene

  1. Select the object that should own the behavior.
  2. Add or configure the component/workflow that references the AngelScript asset.
  3. Assign the script asset.
  4. Save the scene.

<IMG: Scene object inspector showing an AngelScript asset assigned to a component>

Run and Verify

  1. Run the scene.
  2. Confirm that the script compiles.
  3. Check the editor output for script errors or log messages.
  4. Verify that the expected scene behavior occurs.

Troubleshooting

  • If the script asset type is not available, confirm the AngelScript plugin is enabled.
  • If compilation fails, read the first script compiler error before fixing later errors.
  • If the script compiles but does not run, check that the scene object references the asset and that the owning object is active.

Next Step

The next tutorial in this path will connect player input to C++ and AngelScript gameplay behavior.

See Also