greenstack / spite-framework

The Spite Framework is a C# library meant to simplify designing and implementing turn-based gameplay by providing some boilerplate code.
MIT License
6 stars 0 forks source link

Ensure New Code Is Compatible with Minimum Supported Unity Version #29

Closed greenstack closed 3 years ago

greenstack commented 3 years ago

I don't want new versions of Spite to break Unity projects due to C# features that Unity may not yet support.

I think the easiest way to do this is to set the project's C# version to one that matches the lowest supported Unity project. This allows us to not have to set up some kind of pipeline and have the validation at compile time.

When major versions of Spite are released, we can drop support for older Unity versions then. This may also be a good time to revisit what the minimum version of Unity we want to support is.

greenstack commented 3 years ago

Unfortunately, Unity 2021.2 still doesn't support C# 8.0's Default interface methods, Indices and ranges, or other features. While we can avoid these features, I want to be sure we can enforce that before opening it up to other C# 8 features. The same goes for C# 9.0.

So because of that, I'll have Spite support up to C# 7.3 for the time being.

greenstack commented 3 years ago

https://forum.unity.com/threads/unity-future-net-development-status.1092205/ has information regarding status of C# 8 and C# 9 (as well as .NET 6!) in future versions of Unity.

It looks like C# 8/9 (minus covariant return types) will have full support in Unity 2021.2, so that's good news. Since I want to have the fullest feature set available to Spite's developers, and I don't want to bother with keeping support for very old versions of Unity, once Unity 2021.2 comes out, I'll make that the minimum supported version of Unity and bump up the available features in C#. I'll look into style rules that reject covariant return types, if at all possible.