Attributes — Samples¶
Runnable examples for the Attributes system.
Scene¶
Two scenes. Scenes/00_Attributes_Quickstart carries the container and combining panels; Scenes/01_Attributes_Save carries the save panel, following the convention that a save panel gets a scene of its own. Open either and press Play.
See Scenes/ for the index, and each scene's own README for what is in it and what to look for.
What works without other systems¶
All of it. Attributes depends on nothing — no service, no manager, no database, no scriptable object to author. A container is a component you put on an owner, and the whole system is that component plus two interfaces you may choose to implement.
That is worth noticing while you read the panels, because it is unusual here. Inventory needs a database, Crafting needs recipes, Loot needs tables. Attributes needs an object.
The one thing that does reach outside is persistence: AttributesSavePanel uses the save coordinator from Runtime/Core, which ships in every package.
How the scenes are set up¶
Recorded because the choices are load-bearing, not because you need to rebuild them. Both scenes share the same owner setup.
The container is on the player. Characters ▸ Player (Visual Only) carries both the AttributeSet and a StableId — which is where it goes in a real project, and what the walkthrough says out loud. The panels stay off it, so the wiring stays visible as a step rather than baked into the object.
The two must share a GameObject to be saveable. StableIdOwners.Find<AttributeSet>() matches on the same object, so a StableId on a parent and an AttributeSet on a child finds nothing at all — and 01_Attributes_Save would then report a successful capture of zero owners, which is the failure that misleads rather than the one that stops you.
The rows are a mix on purpose:
| id | base | min | max | Why |
|---|---|---|---|---|
strength | 10 | 0 | 100 | Bounded both ends — the only way clamping is demonstrable |
luck | 0 | — | — | Authored and unbounded, so "authored" and "bounded" are visibly different |
debt | -50 | -1000 | 0 | Negative values and negative bounds are ordinary |
The Combiner Component slot is empty, and nothing carries a DemoAttributeProvider. Both are tempting and both would spoil a lesson: the empty slot is what the combining panel is about, and a provider with no combiner makes the container warn in the Console on every load, which reads as a defect in a shipped sample. The combining panel builds its own providers on its own root object and destroys them again.
Panels sit left to right in reading order — in the quickstart, Basics at positionRef x 200 and Combining at x 1000. minSizeRef clamps each to 750 wide, so on a 1920 reference they sit side by side without overlapping. The save scene has one panel and gives it the left slot.
Notes¶
- Compiles only when both
REV_SAMPLES_PRESENTandREV_ATTRIBUTES_PRESENTare defined. - Moving this folder out of
Assets/RevFrameworkclearsREV_SAMPLES_PRESENTand compiles the samples out entirely, which is the supported way to strip them from a build. - Attributes ships in Complete only, so this folder is absent from the three SKU packages.