public void Unload() { m_script = null; if (m_view != null) { GameObject.Destroy(m_view); m_view = null; } }
public void Load(MapData data) { GameObject mapPrefab = Resources.Load <GameObject>("maps/map_" + data.id); m_view = GameObject.Instantiate(mapPrefab); Vector3 size = m_view.GetComponent <SpriteRenderer>().sprite.bounds.size; size.x *= m_view.transform.localScale.x; size.y *= m_view.transform.localScale.y; size.z *= m_view.transform.localScale.z; m_size = size; m_script = m_view.GetComponent <MapScript>(); }