Unity-Technologies / com.unity.netcode.gameobjects

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.15k stars 435 forks source link

Compiler error when using Unity 2017 #106

Closed FireDragonGameStudio closed 6 years ago

FireDragonGameStudio commented 6 years ago

Hy, again ^^ I just managed to import MLAPI successfully but run into an issue with the MLAPI Profiler. The static method AnimationCurve.Constant(float timeStart, float timeEnd, float value) was added in Unity2018 and can not be used in Unity2017. To solve this I replaced it with AnimationCurve.EaseInOut(float timeStart, float valueStart, float timeEnd, float valueEnd) starting with value 0, from which I think it is the equivalent. Is this solution right? Maybe a compiler directive for Unity2017 can be added, to prevent this.

Code example

2018 version

curve = AnimationCurve.Constant(NetworkProfiler.Ticks.ElementAt(0).EventId, NetworkProfiler.Ticks.ElementAt(NetworkProfiler.Ticks.Count - 1).EventId, 0);

2017 version

curve = AnimationCurve.EaseInOut(NetworkProfiler.Ticks.ElementAt(0).EventId, 0, NetworkProfiler.Ticks.ElementAt(NetworkProfiler.Ticks.Count - 1).EventId, 0);

Your Environment

Best regards :)

TwoTenPvP commented 6 years ago

This is 2017.1 specific then. I personally run 2017.3. I will download 2017.1 tomorrow and have a look at this.

TwoTenPvP commented 6 years ago

Just checked the 2017.1 documentation, and yes. Constant does not exist. However, the Linear constructor makes more sense than EaseInOut.

FireDragonGameStudio commented 6 years ago

Thank you for the great support! :)

TwoTenPvP commented 6 years ago

Resolved: https://github.com/MidLevel/MLAPI/commit/470a1e0d436176ce2e7646b748232853c8ac74c0