Unity-AltSourceGenerator icon indicating copy to clipboard operation
Unity-AltSourceGenerator copied to clipboard

System.Runtime.CompilerServices.IsExternalInit is not defined or imported

Open lucasmontec-fortis opened this issue 2 years ago • 1 comments

Hey! Thanks for the project! I'm getting this error as soon as I import it:

Library\PackageCache\com.sator-imaging.alt-source-generator@4fcd4088cd\Runtime\USGContext.cs(8,40): error CS0518: Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

lucasmontec-fortis avatar Jan 19 '24 17:01 lucasmontec-fortis

I was able to fix this by importing your package as a custom package and adding the following class to it:

#if NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP2_2 || NETCOREAPP3_0 || NETCOREAPP3_1 || NET45 || NET451 || NET452 || NET6 || NET461 || NET462 || NET47 || NET471 || NET472 || NET48

using System.ComponentModel;

namespace System.Runtime.CompilerServices
{
    [EditorBrowsable(EditorBrowsableState.Never)]
    internal static class IsExternalInit { }
}

#endif

lucasmontec-fortis avatar Jan 19 '24 18:01 lucasmontec-fortis