RickStrahl / Westwind.Scripting

Small C# library to provide dynamic runtime code compilation from source code for code and expressions execution
210 stars 43 forks source link

Unity (Game Engine) support #28

Open mgood7123 opened 10 months ago

mgood7123 commented 10 months ago

does this support Unity ?

# current packages for working C# api in unity

Microsoft.CodeAnalysis.Common.4.9.0-2.final
Microsoft.CodeAnalysis.CSharp.4.9.0-2.final
Microsoft.CodeAnalysis.CSharp.Scripting.4.9.0-2.final
Microsoft.CodeAnalysis.Scripting.Common.4.9.0-2.final
System.Buffers.4.5.1
System.Collections.Immutable.7.0.0
System.Memory.4.5.5
System.Numerics.Vectors.4.5.0
System.Reflection.Metadata.7.0.0
System.Runtime.CompilerServices.Unsafe.6.0.0
System.Runtime.Loader.4.0.0

Mono runtime

netstandard2.0

IbrahimAkil96 commented 3 months ago

The packages you listed are generally used for scripting and compiling C# code and are compatible with .NET Core and .NET Standard. Here's a breakdown of their compatibility with Unity:

Microsoft.CodeAnalysis.Common, Microsoft.CodeAnalysis.CSharp, Microsoft.CodeAnalysis.CSharp.Scripting, and Microsoft.CodeAnalysis.Scripting.Common: These are part of the Roslyn compiler platform and are typically used for code analysis and scripting. Unity primarily uses its own internal scripting and compilation systems, so these packages might not be directly useful unless you’re building custom tools or editors within Unity.

System.Buffers, System.Collections.Immutable, System.Memory, System.Numerics.Vectors, System.Reflection.Metadata, System.Runtime.CompilerServices.Unsafe, and System.Runtime.Loader: These are libraries that provide various system-level functionality and are generally compatible with .NET Standard 2.0, which Unity supports. However, Unity's .NET runtime (Mono) may have some limitations or differences compared to standard .NET implementations.

Mono runtime: Unity uses a version of Mono for scripting. The packages you listed should work with Unity’s Mono runtime as long as they are compatible with .NET Standard 2.0 or lower.

In general, if you are developing tools or features for Unity that require advanced scripting or code analysis, these packages could be useful. However, for typical Unity development, you might not need these specific packages unless you are working on something that involves code compilation or advanced scripting features.