DarkRewar / BaseTool

A big library of basic tools that you might need in your Unity projects.
MIT License
41 stars 6 forks source link

Array Extensions #64 #65

Closed DarkRewar closed 5 months ago

DarkRewar commented 5 months ago

Array Extensions

GetRandom<T>()

using BaseTool;
using UnityEngine;

GameObject[] objects = new GameObject[5];
var obj = objects.GetRandom();

GetRandom<T>(System.Random random)

using BaseTool;
using System;
using UnityEngine;

Random rand = new Random();
GameObject[] objects = new GameObject[5];
var obj = objects.GetRandom(rand);