I want to randomly pick an item from a scriptable object and then print the randomly chosen item to the console.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Country", menuName = "Country/Country", order = 0)]
public class country : ScriptableObject
{
[System.Serializable]
public class Item
{
public string Name;
public string Currency;
public string Capital;
public string[] City;
}
public Item[] m_Items;
}
How do I go on printing the following values to the console?
public Item PickRandomly()
{
int index = Random.Range(0, m_Items.Length);
return m_Items[index];
}