Unity随机从数组中抽取几个元素使用的基本方法
前言
在今天项目中想开发这样一种功能,在物体数组中随机选择几个物体,使他们随机显示出来。下面是实现这种功能的基本步骤:
步骤
1.添加基本脚本,脚本代码如下所示:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TextBackImageManager : MonoBehaviour
{
//内存展示物体
public GameObject[] textBackImage;
int[] testArray;
// Use this for initialization
void Start ()
{
ToShowMerroy(