public void CollectData(GameObject rootGo) { if (rootGo != null) { MonoBehaviour[] lstDatas = rootGo.GetComponentsInChildren <MonoBehaviour>(); foreach (MonoBehaviour m in lstDatas) { ISaveDataInScene s = m as ISaveDataInScene; if (s != null) { string strKey = m.gameObject.name + s.GetType().Name; int key = strKey.GetHashCode(); _datas[key] = s.ExportData(); } } } }