handzlikchris / handzlikchris/FastScriptReload

Add support to reload modules with Unity's IsExternalInit workaround to C# records

Offen
#111 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C#
Sterne
2.2k
Forks
167
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Unity has limited support to C# records and init only setters, but Unity documentation suggests to manually declare IsExternalInit class:
https://docs.unity3d.com/2021.2/Documentation/Manual/CSharpCompiler.html

We use this approach in project and it works, but FastScriptReload fails to reload such modules, outputs such errors:

046412b42d9540adb22c28aa3d99dce9.SourceCodeCombined.cs(26,25): error CS0518: Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

Looks like it is possible to use same approach (adding IsExternalInit class) with temporary files compilation.
Is there a possibility to reload such code?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with the temporary-files compilation path and compare it with Unity's documented IsExternalInit workaround. Reproduce the CS0518 error for a module using records or init-only setters, then confirm that reloading succeeds without the error.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp, unity
Bereich
game-dev, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
28/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.