handzlikchris / handzlikchris/FastScriptReload

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

Open
#111 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
2.2k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.