Version: 5.4

説明

配列の要素数を返す、または、設定する配列の length プロパティーです。

The Array.length controls how JS can access or set the size of the array. The example JS script below shows that the length property of the array starts with a lower-case "l".

Note: This page includes a c-sharp script example. The use of two array styles and their use of length are shown.

// C# array length example
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { // use string array approach string[] names = new string[]{"Hello", "World", "Really"}; foreach (string s in names) { print("user is: " + s); } print("length is: " + names.Length); // use ArrayList approach ArrayList arr = new ArrayList(); arr.Add("Hello"); arr.Add("World");

// ArrayList uses Count instead of Length print(arr.Count); } }