handzlikchris / handzlikchris/FastScriptReload

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

オープン
#111 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
C#
スター
2.2k
フォーク
167
PR マージ指標
30日以内にマージされた PR はありません

説明

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?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

一時ファイルのコンパイルパスから始め、Unity がドキュメント化している IsExternalInit の回避策と比較します。records または init-only setters を使用するモジュールで CS0518 エラーを再現し、その後、エラーなしで再読み込みが成功することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, unity
領域
game-dev, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
28/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。