Skip to content

Commit f8db77a

Browse files
committed
feat: init accessor
1 parent 9ba33ae commit f8db77a

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

Runtime/IsExternalInit.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#if false == UNITY_2022_1_OR_NEWER
2+
3+
// NOTE: to use record & init accessor in Unity 2021
4+
// https://stackoverflow.com/questions/62648189/testing-c-sharp-9-0-in-vs2019-cs0518-isexternalinit-is-not-defined-or-imported
5+
6+
namespace System.Runtime.CompilerServices
7+
{
8+
[ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never)]
9+
/*internal*/ class IsExternalInit
10+
{
11+
}
12+
}
13+
14+
#endif

Runtime/IsExternalInit.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/USGContext.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33

44
namespace SatorImaging.UnitySourceGenerator
55
{
6-
// OPTIMIZE: Be ref struct
7-
public class USGContext
6+
public sealed class USGContext
87
{
9-
public Type TargetClass;
10-
public string AssetPath;
11-
public string OutputPath;
8+
public Type TargetClass { get; init; }
9+
public string AssetPath { get; init; }
10+
public string OutputPath { get; set; }
1211

1312
}
1413
}

0 commit comments

Comments
 (0)