string good = { “projectileSizeUp”, “projectileNumUp”, “projectileSpeedUp”, “fireRateUp”, “shieldUp”, “gainHealth”, “maxHealthUp”, “critChanceUp”, “damageUp”, “critDamageUp”, “speedUp”, “Shuriken”, “Sword”, “Laser”, “Grenade”, “Axe”, “SecondGun”, “Rocket”, “Mine”, “Lightning” };
string bad = { “projectileSizeDown”, “projectileSizeDown”, “projectileNumDown”, “projectileSpeedDown”, “fireRateDown”, “shieldDown”, “loseHealth”, “loseHealth”, “maxHealthDown”, “critChanceDown”, “damageDown”, “critDamageDown”, “speedDown”, “ExtraBoss”, “ExtraEnemies”, “ExtraEnemies”, “ExtraEnemies”, “ExtraEnemies”, “ExtraEnemies”, “ExtraEnemies” };
List goodCards = new List(good);
List badCards = new List(bad);
UnityEngine.Debug.Log(Random.Range(0, good.Length));
UnityEngine.Debug.Log(Random.Range(0, bad.Length));
all this does is output a number. Why is this?
because that is what Random.Range does… it picks a random number between minInclusive and maxExclusivewhich you have defined as 0 and bad.Length, what you need to do is apply this number to your list as an index. Your list bad has 20 strings in it, it’s a list of 20 elements, you pick a number from 0 to 20 and it gives it to you, you must take that number and use it as an index to your collection. bad[Random.Range(0, bad.Length)]; and that will get you the string located at that index.