Vad är filformatet TSCN?
En .tscn-fil är en textscen skapad av Godot Engine, den kostnadsfria spelmotorn med öppen källkod för att bygga 2D- och 3D-spel. TSCN står för «text scene», och varje fil beskriver ett enskilt scenträd: noderna som utgör en nivå, karaktär, UI-skärm eller återanvändbar komponent, tillsammans med deras egenskaper och anslutningar.
Formatet är av INI-typ och läsbart. En fil öppnas med en beskrivningsrad som [gd_scene format=3 uid="uid://cecaux1sm7mo0"], följt av [ext_resource]-poster som länkar till externa tillgångar, [sub_resource]-poster som bäddar in data som material och kollisionsformer, [node]-poster som bygger trädet och [connection]-poster som kopplar ihop signaler. Godot 3.x sparar format=2; Godot 4.x sparar format=3 och lägger till strängbaserade UID:er så att en scen kan spåras även efter att den flyttats. Eftersom formatet är vanlig text kan det diffas och sammanfogas rent i Git, vilket är en anledning till att team föredrar det framför den binära .scn-varianten.
Säkerhet & trygghet
RISK: LOWA .tscn is plain UTF-8 text, so it cannot execute on its own. Scenes can reference GDScript (.gd) files that do run inside Godot, so treat scenes from untrusted projects with the same caution as any downloaded source code. Opening a .tscn in a text editor is harmless.
Formatdetaljer
i ett nötskalProgram som öppnar TSCN-filer
Tekniska detaljer
djup specifikation| Encoding | UTF-8 plain text |
| Byte order | Not applicable (text format) |
| Container | INI-style sections with bracketed headings and key = value property lines |
| Compression | None; the text file is uncompressed. Godot compiles it to a binary form on import for faster loading. |
| Encryption | None by default |
| Typical size | A few hundred bytes to several hundred KB depending on node count and embedded sub-resources |
| Structure | Five ordered parts: a single [gd_scene] descriptor line, [ext_resource] entries pointing to external files, [sub_resource] entries holding embedded data, [node] entries describing the scene tree, and [connection] entries for signal wiring. An optional [editable] section marks instanced sub-scenes as editable. |
| Integrity | None built in |
| Platforms | Windows, macOS, Linux, Android, Web |
| Notes | The descriptor carries format=2 for Godot 3.x and format=3 for Godot 4.x. Godot 4 replaced incremental integer resource IDs with string-based uid values (uid://...). References inside the file use ExtResource("id") and SubResource("id"). Single-line comments start with a semicolon and are stripped when the editor re-saves the file. The .escn export variant uses the identical format but signals that the file came from another program and should not be hand-edited in Godot. |
| Human Readable | Yes, this is a design goal of the format for version control diffing and merging |
| Släppt | 2016 (Godot 2.x era; format=2 in Godot 3.x, format=3 in Godot 4.x) |
| Senaste version | format=3 (Godot 4.x) |
| Specifikation | docs.godotengine.org |
TSCN-konverteringar
Frågor & svar
frågat av användareInga frågor än - bli den första att fråga om TSCN-filer.
Vanliga frågor
Hur öppnar jag en .tscn-fil?
Kan jag redigera en .tscn-fil manuellt?
Vad är skillnaden mellan .tscn och .scn?
.tscn är text och fungerar bra med versionshantering, medan .scn är den kompilerade binära formen som laddas snabbare och är mindre. Godot genererar en binär version vid import.Varför börjar min .tscn med [gd_scene format=3]?
format=3 betyder att den sparades av Godot 4.x; format=2 betyder Godot 3.x.