(サンプルスクリプト)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandomNum : MonoBehaviour
{
private int[] num = new int[] { 5, 10, 15, 20 };
void Update()
{
if(Input.GetKeyDown(KeyCode.Z))
{
print(num[Random.Range(0,num.Length)]);
}
}
}
(実行結果)