Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

vector2 with switch statement

//this goes where you're declaring variables
public Vector2 foo = Vector2.zero;

//this is what the switch statement would look like
switch (foo)
{
	case Vector2 v when v.Equals(Vector2.up):
		Debug.Log("Up");
		break;
	case Vector2 v when v.Equals(Vector2.left):
		Debug.Log("Left");
		break;
	case Vector2 v when v.Equals(Vector2.back):
		Debug.Log("Back");
		break;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: json property c# 
Csharp :: unity call function on update once per second 
Csharp :: C# Http.HttpRequestMessage 
Csharp :: c# function return 
Csharp :: font dialog c# code 
Csharp :: c# .net core memory cache 
Csharp :: how to check type c# 
Csharp :: linq query to check if record exists 
Csharp :: convert object to httpcontent c# 
Csharp :: multiplication using arrays 
Csharp :: unity class 
Csharp :: The foreach Loop c# 
Csharp :: c# enum 
Csharp :: print an array in c# 
Csharp :: how do you make a 2D object follow another 2D object in unity 2D 
Csharp :: change scale of an object unity 
Csharp :: group by ef core 
Csharp :: how to filter a datatable in c# 
Csharp :: how get the user show mvc controller core 3.1 
Csharp :: c# how to crete array 
Csharp :: how to make pc bsod C# 
Csharp :: c# datagridview hide header 
Csharp :: set current date to textbox in asp.net 
Csharp :: scale between tow ranges c# 
Csharp :: random string generator c# 
Csharp :: c# convert datetime to year & month 
Csharp :: switch statement c# example 
Csharp :: c# remove everything after last slash 
Csharp :: c# linq list select 
Csharp :: add list to list c# 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =