Answers for "arrays in unity"

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
7

unity array c#

string[ ] familyMembers = new string[]{"John", "Amanda", "Chris", "Amber"} ; 
 
string[ ] carsInTheGarage = new string[] {"VWPassat", "BMW"} ; 
 
int[ ] doorNumbersOnMyStreet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; 
 
GameObject[ ] carsInTheScene = GameObject.FindGameObjectsWithTag("car");
Posted by: Guest on April-12-2020
1

unity array c#

public string[] myArrayName = new string[4];
Posted by: Guest on April-12-2020
0

unity array c#

public string[ ] familyMembers = new string[ ]{"Greg", "Kate", "Adam", "Mia"} ;
Posted by: Guest on April-12-2020
0

array in c# unity

using UnityEngine;
using System.Collections;

public class Arrays : MonoBehaviour
{
    public GameObject[] players;

    void Start ()
    {
        players = GameObject.FindGameObjectsWithTag("Player");
        
        for(int i = 0; i < players.Length; i++)
        {
            Debug.Log("Player Number "+i+" is named "+players[i].name);
        }
    }
}
Posted by: Guest on January-30-2021
-1

unity array c#

GameObject[ ] carsInTheScene = GameObject.FindGameObjectsWithTag("car");
Posted by: Guest on April-12-2020

C# Answers by Framework

Browse Popular Code Answers by Language