private void Start() { #if UNITY_EDITOR if (!Application.isPlaying) { if (IdentifiersMap.Instance != null) { if (GetComponent <ResourceGroup>() == null) { ResourceMapGen.CreateResourceMap(true); } } } #endif //if (m_replacementPrefabChildren != null && m_replacementPrefabChildren.Length > 0) //{ // m_replacementPrefabChildrenHS = new HashSet<Transform>(m_replacementPrefabChildren); //} //m_isStarted = true; }
private void OnGUI() { EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); GUILayout.Label(m_Logo); EditorGUI.BeginChangeCheck(); GUILayout.BeginVertical(); EditorGUILayout.Separator(); EditorStyles.label.wordWrap = true; EditorStyles.label.fontStyle = FontStyle.Bold; EditorGUILayout.LabelField("Save&Load subsystem require ResourceMap to work property"); EditorStyles.label.fontStyle = FontStyle.Normal; EditorGUILayout.LabelField("NOTE: You will need to update resource map each time you add new resources to project."); EditorGUILayout.LabelField("To update resource map use Tools->Runtime SaveLoad->CreateResourceMap menu item."); GUILayout.EndVertical(); GUILayout.EndHorizontal(); EditorGUILayout.Separator(); if (GUILayout.Button("Create Resource Map")) { if (Application.isPlaying) { EditorUtility.DisplayDialog("Unable to create Resource Map", "Application.isPlaying == true", "OK"); } else { ResourceMapGen.CreateResourceMap(true); Close(); } } }
//unity version 5.5.2 replacement prefab is not needed anymore //[SerializeField] //private PersistentIgnore m_replacementPrefab; //[SerializeField, UnityEditorOnly] //private Transform[] m_replacementPrefabChildren; //private HashSet<Transform> m_replacementPrefabChildrenHS; //unity version 5.5.2 replacement prefab is not needed anymore //public PersistentIgnore ReplacementPrefab //{ // get { return m_replacementPrefab; } //} //public bool IsChildOfReplacementPrefab(Transform child) //{ // if (m_replacementPrefabChildrenHS == null) // { // if (!m_isStarted) // { // m_replacementPrefabChildrenHS = new HashSet<Transform>(m_replacementPrefabChildren); // } // else // { // return false; // } // } // bool contains = m_replacementPrefabChildrenHS.Contains(child); // return contains; //} private void Awake() { if (!Application.isPlaying) { m_isRuntime = false; if (!string.IsNullOrEmpty(m_guid)) { Guid guid = new Guid(m_guid); if (m_instances.ContainsKey(guid)) { if (m_instances[guid] != this) { guid = Guid.NewGuid(); m_instances.Add(guid, this); m_guid = guid.ToString(); #if UNITY_EDITOR ResourceGroup rg = GetComponent <ResourceGroup>(); if (rg != null) { DestroyImmediate(rg); ResourceMapGen.CreateResourceMap(true); } #endif } } else { m_instances.Add(guid, this); } } else { Guid guid = Guid.NewGuid(); m_instances.Add(guid, this); m_guid = guid.ToString(); } } else { if (string.IsNullOrEmpty(m_guid)) { m_isRuntime = true; } else { if (m_instances == null) { m_instances = new Dictionary <Guid, PersistentIgnore>(); } Guid guid = new Guid(m_guid); if (m_instances.ContainsKey(guid)) { m_isRuntime = true; } else { m_isRuntime = false; m_instances.Add(guid, null); } } } }
public static void CreateResourceMap() { ResourceMapGen.CreateResourceMap(true); }