Component Manager

Components

In Craftland Studio PC, a “component” can be understood as a container holding data.
An entity itself is merely an empty identifier; what it can do and how it behaves depends entirely on which components are attached to it.

  • Movement Component: Stores only movement-related data, such as movement speed and direction.
  • Render Component: Stores data required for rendering, such as models and materials.
  • Collision Component: Stores data for collision detection, such as collision volumes and shapes.

The system locates entities possessing specific combinations of components and determines the behavioral logic to execute on these entities based on the data within those components.

Component Management

Access Component Management via the menu

image-20251125174607079

image-20251125174656617

You can also directly access a component’s management UI from the component itself:

image-20251125174644533

image-20251125174720819

Scripts

Mounting scripts to a component is equivalent to mounting scripts to all entities that use that component:

image-20251125175304300

image-20251125175249160

image-20251125175923212

Property

Default Property

By default, most components already come with default properties.

image-20251201112745685

Property Types

Properties are categorized as read-only or writable. Read-only properties can only be queried for their values and cannot be modified via script; writable properties can be modified through scripting.

image-20251201112959371

Writable properties

image-20251201113027758

Read-only property

Whether a property is writable can also be determined by whether its default property entry is highlighted.

image-20251201113138046

For example, the position property of the player differs from the position property of the transform component used by other objects and cannot be directly modified via the setProperty API. To move the player, use the dedicated teleportPlayer API:

image-20251201113836975 image-20251201113913733

Use the Set Property API to modify writable properties; use the Get Property API to read property values:

image-20251201120211092

Additionally, some default properties are server-only. Attempting to modify them on the client will result in errors. In block scripts, these properties are automatically filtered based on the script’s runtime platform.

Custom Properties

Beyond the available default properties, you can also add custom properties to components. Custom properties are writable and work on both client and server.

image-20251201141535496

Custom Property Detection

You may have noticed a monitoring icon next to custom properties:

image-20251201151540296

Enabling this monitoring triggers the system to send a “Custom Property Change” event whenever the property’s value changes, following this logic:

  1. When the property is modified in server-side logic, the event is sent to both server and client.
  2. When the property is modified in client-side logic, the event is sent only locally.

Using the Custom Property Change event, you can more conveniently detect property alterations and subsequently edit subsequent logic:

image-20251201152041181

If multiple custom properties have change detection enabled, you can use the custom property ID block to pinpoint which specific property has changed:

image-20251201155511248

When using the Custom Property ID block, manually specify the component type

Associated Components

A component may have multiple associated components. The combination, references, or dependencies between components define an entity’s logical and data capability boundaries.

For example, the Player component binds to Combatable, Scoreable, and other components. Player entities using the Player component can also utilize Combatable and Scoreable data and events.

image-20251201173940400