Skip to main content
This quickstart walks you through creating a script, attaching it to an entity, and running it in Play mode.

Prerequisites

Before you begin, make sure you have:
  • WizardMachine installed from the Microsoft Store.
  • A code editor. This guide uses Visual Studio Code.
  • The WIZMEXT VS Code extension, for syntax highlighting and code completion.

Create and run your first script

1

Create a script

In the Content Browser, select + Add > New Script and name it hello. WizardMachine creates a hello.wscript file containing a behaviour class named after the file, with empty Start and Update methods.
2

Open the script

Open hello.wscript in Visual Studio Code.
3

Write your behaviour

Replace the contents with the following and save the file:
Start runs once before the first update, and Update runs every frame.
4

Add a Scripting component

Select the entity you want to drive, then add a Scripting component from the Add Component menu.
5

Assign the script

Assign hello to the Scripting component. The class’s public fields, such as greeting, appear underneath it, where you can change them for this entity.
6

Enter Play mode

Start the game. The entity spins, and the greeting is written to the log. Press Stop or Escape to end the session and restore the level to its pre-play state.

Next steps

Scripting reference

Explore the full entity API, input, physics, UI, and save data.
Need help? Reach out at sebastianrautenbachwork@gmail.com.