rustic.get_object_attribute()
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.get_object_attribute(source, name)
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
| Variable | Type | Required | Description |
|---|---|---|---|
source | string | Yes | Stable entity ID or full rustic.game.Scene.Root.Child path for object helpers. |
name | string | Yes | Name, Position, Size, Color (RGB), CanTouch, CanCollide, DoubleSided (boolean), Anchored, Friction (number, 0..10), or Parent. |
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
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})JavaScript
const name = rustic.get_attribute('Name');
rustic.edit_attribute('Color', [1, .5, 0]);
rustic.game.Demo.Room.Player.EditAttribute("Color", [1,.5,0]);
rustic.edit_object_attribute("rustic.game.Demo.Room.Player", "Color", [1,.5,0]);
const position = rustic.get_object_attribute(rustic.entity_id(), 'Position');
rustic.edit_object_attribute(rustic.entity_id(), 'Color', [1, .5, 0]);Python
name = rustic.get_attribute('Name')
rustic.edit_attribute('Color', [1, .5, 0])
rustic.game.Demo.Room.Player.EditAttribute("Color", [1,.5,0])
position = rustic.get_object_attribute(rustic.entity_id(), 'Position')
rustic.edit_object_attribute(rustic.entity_id(), 'Color', [1, .5, 0])C++
auto name = rustic.get_attribute("Name");
rustic.edit_attribute("Color", RusticValue::Array{1.0, .5, 0.0});
rustic.game["Demo"]["Room"]["Player"].EditAttribute("Color", RusticValue::Array{1.0,.5,0.0});
auto position = rustic.get_object_attribute(rustic.entity_id(), "Position");
rustic.edit_object_attribute(rustic.entity_id(), "Color", RusticValue::Array{1.0, .5, 0.0});C#
string? name = (string?)rustic.get_attribute("Name");
rustic.edit_attribute("Color",new double[]{1,.5,0});
rustic.game.Demo.Room.Player.EditAttribute("Color", new double[]{1,.5,0});
var position = rustic.get_object_attribute(rustic.entity_id(), "Position");
rustic.edit_object_attribute(rustic.entity_id(), "Color",new double[]{1,.5,0});Luau
local name = rustic.get_attribute('Name')
rustic.edit_attribute('Color',{1,.5,0})
rustic.game.Demo.Room.Player:EditAttribute("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})C
RusticValue name = rustic.get_attribute("Name");
rustic.edit_attribute("Color",(RusticValue){.type=RUSTIC_VECTOR,.vector={1,.5,0},.length=3});
rustic.game.EditAttribute("Demo", "Room.Player", "Color", (RusticValue){.type=RUSTIC_VECTOR,.vector={1,.5,0},.length=3});
RusticValue position = rustic.get_object_attribute(rustic.entity_id(), "Position");
rustic.edit_object_attribute(rustic.entity_id(), "Color",(RusticValue){.type=RUSTIC_VECTOR,.vector={1,.5,0},.length=3});Java
String name = (String)rustic.get_attribute("Name");
rustic.edit_attribute("Color",new double[]{1,.5,0});
rustic.game.scene("Demo").object("Room.Player").EditAttribute("Color", new double[]{1,.5,0});
var position = rustic.get_object_attribute(rustic.entity_id(), "Position");
rustic.edit_object_attribute(rustic.entity_id(), "Color",new double[]{1,.5,0});PHP
$name = $rustic->get_attribute("Name");
$rustic->edit_attribute("Color",[1,.5,0]);
$rustic->game->Demo->Room->Player->EditAttribute("Color", [1,.5,0]);
$position = $rustic->get_object_attribute($rustic->entity_id(), "Position");
$rustic->edit_object_attribute($rustic->entity_id(), "Color",[1,.5,0]);HTML / inline JS
const name = rustic.get_attribute('Name');
rustic.edit_attribute('Color', [1, .5, 0]);
rustic.game.Demo.Room.Player.EditAttribute("Color", [1,.5,0]);
rustic.edit_object_attribute("rustic.game.Demo.Room.Player", "Color", [1,.5,0]);
const 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
- DoubleSided defaults to false; true renders both inside and outside faces of primitives and imported meshes in editor and game views, without changing collision geometry. 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 enables object clicks, touchscreen taps and collision subscriptions when both bodies allow touch; it does not affect solid response. Friction defaults to 0.5 and accepts finite coefficients from 0 through 10. See Touchscreen input and object clicks. 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.