Skip to main content

Components

tip

This page is about Kalem. The editor itself is documented at editor.playcaria.com.

In Sakin Editor a script is attached as a component, as a behaviour is in Unity's Inspector: to a package (a building, a character, an object), to one of its parts, or to the world.

In the document​

A component is kept in the components list of the package's object.json, of a part, or of the .world document:

"components": [
{"id": "b1ff2401-…", "script": "kalem/business-hours", "enabled": true, "values": {"opensAt": 1200}}
]
  • script is the script's id, from its file name (Script).
  • values keeps only the properties that differ from the script's defaults; a time is kept as the minute of the day (1200 is 20:00).
  • enabled: false keeps the component but does not run it.
  • The order of the list is the order the scripts run in within a minute (The order of work).

In the Inspector​

  • Add Component opens a selector of the project's scripts that can go on the selection, by their host type (Host types), with their category, description, properties and the events they react to. A script that cannot be added yet still shows, with why: it has errors, it is already there, its header is not ready.
  • A component's card is made from the script: its properties by group, with their labels, ranges and tooltips; a client script's input with the field it reads.
  • Cards can be reordered, switched off and removed; every change is one undoable command.

Fields​

The package's contract fields are in the Inspector's Fields section. A card shows the fields its script reads and writes and whether the package has them; Add the fields they use adds the missing ones with the types the script uses (Contract fields).

Writing scripts​

.kalem files are written in the editor with Kalem's language server: errors as you type, colouring, completion (events, fields, library functions), documentation on hover, go to definition and usages. New › Sakin › Kalem Script creates a script whose name and file come from its label.