C#] [Export] does not support struct types (GD0102), inconsistent with GDScript struct support

Aperta
#1,589 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
game-dev

Direzione di ricerca

Start by tracing the GD0102 diagnostic for exported C# members and the export type validation path; the issue names no source files or tests. Check how GDScript struct support is represented and compare it with C#/Mono exports. Done means either C# struct fields can be exported with suitable coverage, or the limitation is documented clearly.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement topic:dotnet usability
Tested versions

Latest Redot stable build.

System information

Window 11

Issue description

GDScript has support for struct types, but the equivalent C#/Mono side does not — marking a C# struct field with [Export] fails to compile with GD0102. This is inconsistent: both GDScript and C# are first-class scripting languages in Redot, but only one of them can use structs as an exportable grouping of related fields.

Expected: a C# struct should be exportable via [Export], consistent with GDScript's struct support — or, if this is intentionally unsupported, it should be documented clearly as a known C#/Mono limitation rather than failing with a generic "type not supported" diagnostic.

Actual: the project fails to build entirely, and they say that struct are not supported.

Steps to reproduce

Create a C# script with a [Export] field typed as a custom struct.
Attempt to build the project.
Build fails with GD0102.
Minimal reproduction code:


public partial class Test : Node
{
    [Export] Stats stats;
}

public partial struct Stats
{
    public int health;
    public int maxHealth;
    public int level;
    public int maxLevel;
}

Error output:

GD0102: The type of the exported member 'Test.stats' is not supported

Minimal reproduction project (MRP)

Not needed just create a new mono project and export the C# struct as a member it will throw an error.

Lingua principale
C++
Stelle
6.1k
Fork
337
Merge medio
5g 8h
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Redot-Engine/redot-engine

Tutte le issue di Redot-Engine/redot-engine

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.