using System; using System.Collections.Generic; using UnityEngine; [ExecuteInEditMode] [CreateAssetMenu(fileName = "LocationsInfo", menuName = "EditorDatas/LocationsInfo", order = 1)] public class DataLocationsInfo : ScriptableObject { [Serializable] public struct City { public string name; public List places; } [Serializable] public struct State { public string name; public List cities; } public List states = new List(); public void GetLocationData(string locId, out string locCity, out string locState) { locCity = ""; locState = ""; foreach(State state in states) { foreach(City city in state.cities) { foreach(string place in city.places) { if(place.ToUpper() == locId.ToUpper()) { locCity = city.name; locState = state.name; return; } } } } } }