unitytips: Tuple Patterns
01/12/2020
Unity started to supporting C# 8.0 with version 2020.2 beta and now we can start to use some new features like the Tuple Patterns.
Introduction
Some algorithms depend on multiple inputs. Tuple patterns allow you to switch based on multiple values expressed as a tuple.
The tuples provides concise syntax to group multiple data elements in a lightweight data structure.
Sample
In this sample MonoBehaviour, we will get the message to indicate the winner of the game rock, paper, scissors.
Loading comments...