Answers for "unity array declaration"

C#
5

unity define array

int[] arr1 = new int[3]; 
 // Create an integer array with 3 elements
 var arr2 = new int[3]; 
 // Same thing, just with implicit declaration 
 var arr3 = new int[] { 1, 2, 3 };  
 // Creates an array with 3 elements and sets values.
Posted by: Guest on April-21-2021
1

unity make a int arry with preset values

// For a preset arry in c#

var arr = new string[3] {"one", "two", "three"};

// Or you can do this:
 string[] arr = {"one", "two", "three"};
Posted by: Guest on January-06-2020

C# Answers by Framework

Browse Popular Code Answers by Language