bottlenoselabs / c2cs

Generate C# bindings from a C header.
MIT License
250 stars 18 forks source link

Some new C# features do not work in Unity #124

Closed mikoro closed 1 year ago

mikoro commented 1 year ago

Specifically this:

            [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
            public sealed class CNodeAttribute : Attribute
            {
                public string Kind { get; init; } = string.Empty;

                public string Platform { get; init; } = string.Empty;

                public string Location { get; init; } = string.Empty;
            }

will cause:

error CS0518: Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

This worked in Unity with the previous version. Replacing init with set seems to work.

lithiumtoast commented 1 year ago

Thanks!