The .rscene and .rprefab format
A complete level with two prefab instances, an external style and a saved signal; file structure and UIDs.
Run the complete example
In a Reckfell 1.0.0 C# project create these files at the shown paths relative to asset://. Put FormatGallery2D.cs at the project root. Attach it to an Entity2D in a separate level, set a 640×420 base viewport, build C# and press F6. Two blue objects appear. The right one is larger; × deletes only its own instance.
Assets/BadgeStyle.rdata
[reckfell_resource type="StyleBoxFlat" format=3]
[resource]
bg_color = Color(0.18, 0.36, 0.95, 1)
corner_radius_top_left = 12
corner_radius_top_right = 12
corner_radius_bottom_left = 12
corner_radius_bottom_right = 12Actors/Badge.rprefab
; This comment is not retained by ResourceSaver.
[reckfell_tree format=3]
[ext_resource type="StyleBox" path="asset://Assets/BadgeStyle.rdata" id="Style"]
[entity name="Badge" type="Entity2D" groups=["format_badges"]]
[entity name="Panel" type="Panel" parent="."]
offset_right = 112.0
offset_bottom = 64.0
mouse_filter = 2
theme_override_styles/panel = ExtResource("Style")
[entity name="Mount" type="Entity2D" parent="."]
[entity name="Pivot" type="Marker2D" parent="."]
unique_name_in_owner = true
position = Vector2(56, 32)
[entity name="Remove" type="Button" parent="."]
offset_left = 76.0
offset_top = 12.0
offset_right = 102.0
offset_bottom = 52.0
text = "×"
[connection signal="pressed" from="Remove" to="." method="queue_free"]Levels/FormatShowcase.rscene
[reckfell_tree format=3]
[ext_resource type="PackedEntity" path="asset://Actors/Badge.rprefab" id="Badge"]
[entity name="FormatShowcase" type="Entity2D"]
[entity name="Left" parent="." instance=ExtResource("Badge")]
position = Vector2(100, 190)
[entity name="Right" parent="." instance=ExtResource("Badge")]
position = Vector2(350, 190)
scale = Vector2(1.25, 1.25)FormatGallery2D.cs
using Reckfell;
public partial class FormatGallery2D : Entity2D
{
public Entity2D Gallery { get; private set; } = null!;
public override void _Ready()
{
var packed = ResourceLoader.Load<PackedEntity>("asset://Levels/FormatShowcase.rscene");
if (packed is null || !packed.CanInstantiate())
{
ReckfellApi.PrintErr("Cannot load FormatShowcase.rscene");
return;
}
Gallery = packed.Instantiate<Entity2D>();
AddChild(Gallery);
AddChild(new Label
{
Position = new Vector2(28, 24),
Text = TranslationServer.GetLocale().StartsWith("ru")
? "Уровень: два экземпляра одного префаба"
: "Level: two instances of one prefab"
});
foreach (string name in new[] { "Left", "Right" })
{
var instance = Gallery.GetEntity<Entity2D>(name);
var pivot = instance.GetEntity<Marker2D>("%Pivot");
instance.AddChild(new Label { Position = new Vector2(0, 84), Text = name + " · %Pivot " + pivot.Position });
}
}
}Read the tree
The first [reckfell_tree] tag identifies a PackedEntity tree. It is followed by ext_resource, sub_resource when needed, entity and connection entries. A .rdata file starts with [reckfell_resource type="..."]; its main resource properties follow [resource].
| Entry | Meaning |
|---|---|
| ext_resource | An external asset reference with path, type and local id |
| sub_resource | A resource embedded in this file, not a separate neighboring asset |
| ExtResource("Badge") | A reference to an external resource's local id |
| SubResource("Shape") | A reference to an embedded resource's local id |
| entity with type | Creation of the specified Entity class |
| entity with instance | Instantiation of a PackedEntity |
| parent="." | An immediate child of this file's root |
| connection | A saved signal → method connection using from/to Entity paths |
id="Badge" is a local reference label, not a global UID. parent is an Entity-tree path, not a filesystem path. Left/Right position and scale are instance overrides; they do not rewrite Badge.rprefab. Both instances use one external StyleBox; changing that shared resource can affect both.
Ordinary child entries restore their owner to the prefab root here. In C#, AddChild alone does not assign Owner; see programmatic packing. The native fixture verifies actual owner scopes and the saved signal rather than only successful text parsing.
UIDs and local identifiers
A header uid="uid://..." identifies the file. An entity unique_id helps serialization track an Entity entry; UniqueNameInOwner and %Pivot instead locate an object within an Owner scope. These values are not interchangeable and are not network IDs.
A UID neither contains the file nor discovers every moved file by itself. It needs a UID → path registry. In runtime, ResourceLoader.GetResourceUid reads that registry; the checked editor-mode source can also read headers through resource loaders. ResourceUid.PathToUid can return the original path when no UID is known. The fresh-process check explicitly rebuilds the generated fixture asset's mapping; it does not establish automatic user:// discovery.
Address player saves in user:// through your own schema and stable gameplay IDs. ResourceSaver.SetUid does not register a runtime mapping. In this checked build, a user:// case returns Ok but leaves a temporary .uidren without replacing the original file; the example does not rely on that method.
Diagnose a failed load
| Symptom | Check |
|---|---|
| Unrecognized type or parse failure | Header, extension, quoting, value types and the reported line |
| Saved with newer format version | Do not edit the number to bypass it; open with a build supporting the data |
| Missing external resource | path, local id and required asset import |
| Entity lookup fails | Name and parent; for %Name also Owner and UniqueNameInOwner |
| Comments or default values disappear | Saver normalization, not proof of lost gameplay behavior |
Semicolon comments and optional spacing do not retain their original formatting after saving. The older load_steps field is neither an Entity count nor the engine version; the current saver omits it. Let the editor preserve unique_id/parent_id_path/owner_uid_path for arbitrary nested trees rather than inventing them manually.