RUSTICDOCSSearch documentation

rustic.edit_object_attribute()

Built-in attributes

Compatibility

Supported languages: C, C++, C#, Python, JavaScript, Lua 5.4, Luau, Java, PHP and HTML/inline JavaScript (binding spellings and return shapes differ).

Use a compatible native engine build and the language tools required by your binding. This does not establish browser/mobile export or release qualification for every OS.

The signature below is the shared reference notation; language examples show the actual binding syntax. Question marks mark optional arguments and explicit defaults are shown where recorded. Do not copy reference notation as a typed declaration.

See Feature status and compatibility for API 1.0/1.1 and per-method restrictions. Engine release tags and Docs v0.1 are independent versions.

Signature

rustic.edit_object_attribute(source, name, value)

Setup and usage

Use attributes for built-in entity state. Prefer set_translation for Position and set_enabled for Enabled when those dedicated calls better express intent.

Parameters

VariableTypeRequiredDescription
sourcestringYesStable entity ID or full rustic.game.Scene.Root.Child path for object helpers.
namestringYesName, Position, Size, Color (RGB), CanTouch, CanCollide, Anchored, or Parent.
valueattribute-specificYesValue matching the attribute type.

Return and timing

Get returns the current value. Edit validates a typed mutation; write timing depends on the runtime.

Execution behavior

Core write timing differs between immediate Lua host calls, deferred JavaScript/Web commands and external SDK query flushes. Scheduled actions advance with the scene clock; synchronous queries evaluate at the call. Follow execution rules and the return/timing notes for this category.

Language examples

Use these snippets inside Start/on_start after generating the Programming Workspace and attaching the script. Python imports rustic, Game and instance from rustic; C++ includes rustic.hpp; C includes rustic.h; C# uses using static Rustic; Java runs inside a Rustic subclass; PHP declares global $rustic, $Game, $instance in its callback. HTML uses an inline script in a ui/ asset. See Lifecycle callbacks for complete registration examples. Public-property examples require a declared integer health property. Scene examples require the named objects to exist before Play.

Lua 5.4

lua
local name = rustic.get_attribute('Name')
rustic.edit_attribute('Color', {1, .5, 0})
rustic.game.Demo.Room.Player:EditAttribute("Color", {1,.5,0})
local targetColor = rustic.game.Demo.Room.Player:GetAttribute("Color")
rustic.edit_object_attribute("rustic.game.Demo.Room.Player", "Color", {1,.5,0})
local position = rustic.get_object_attribute(rustic.entity_id(), 'Position')
rustic.edit_object_attribute(rustic.entity_id(), 'Color', {1, .5, 0})

Shared Built-in attributes constraints

  • In Play, unanchored built-in primitives fall under gravity; CanCollide enables solid box response only when both objects enable it. Anchored prevents physics movement and clears velocity on the next fixed tick. CanTouch does not affect solids; no collision or touch callbacks are emitted. Imported meshes do not simulate yet. See the Basic physics guide for setup and limits. Unknown attributes and type changes are rejected. Parent accepts a stable entity ID or null. Target another object with rustic.game.Scene.Root.Child:EditAttribute in Lua, native member calls in JavaScript/Python/C#/PHP, C++ subscripts, or an edit_attribute protocol command containing source. See Edit scene objects for setup, native calls in every language, and runtime limits.
  • Every gameplay language calls the engine-owned API. Rustic supplies SDKs and dispatches callbacks; scripts do not parse requests or serialize responses. See the language guide for complete setup and callback registration.
  • The direct edit_object_attribute helper is available in embedded Lua and JavaScript (including HTML); other SDKs use the native scene-object call shown above. Only embedded Lua exposes a path-based GetAttribute. For the scene-object example, create a scene named Demo with Room → Player. Change those names to match your scene; see Edit scene objects for full setup.

Errors and debugging

Read the constraints above and the Console diagnostic. Invalid types, non-finite values, stale targets or unavailable native services can fail validation. A failed callback disables the behavior; a failed source reload keeps the last good instance. Exact error messages depend on the language adapter. See Troubleshooting.

All attributes APIs