public GameObject ObjectIDToField(GameObject field, int _constantID) { if (_constantID != 0) { ConstantID newID = Serializer.returnComponent <ConstantID>(_constantID); if (field != null && field.GetComponent <ConstantID>() != null && field.GetComponent <ConstantID>().constantID == _constantID) { } else if (newID != null && !Application.isPlaying) { field = newID.gameObject; } EditorGUILayout.BeginVertical("Button"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Recorded ConstantID: " + _constantID.ToString(), EditorStyles.miniLabel); if (field == null) { if (GUILayout.Button("Search scenes", EditorStyles.miniButton)) { AdvGame.FindObjectWithConstantID(_constantID); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } return(field); }
protected void SharedGUI() { ConstantID _target = (ConstantID)target; if (!_target.gameObject.activeInHierarchy) { _target.constantID = 0; } EditorGUILayout.LabelField("ID: " + _target.constantID); EditorUtility.SetDirty(_target); }
protected void SharedGUI() { ConstantID _target = (ConstantID)target; EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Constant ID number", EditorStyles.boldLabel); _target.autoManual = (AutoManual)EditorGUILayout.EnumPopup("Set:", _target.autoManual); _target.retainInPrefab = EditorGUILayout.Toggle("Retain in prefab?", _target.retainInPrefab); if (!_target.gameObject.activeInHierarchy) { // Prefab if (!_target.retainInPrefab && _target.constantID != 0) { _target.constantID = 0; } else if (_target.retainInPrefab && _target.constantID == 0) { _target.SetNewID_Prefab(); } } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("ID:", GUILayout.Width(50f)); if (_target.autoManual == AutoManual.Automatic) { EditorGUILayout.LabelField(_target.constantID.ToString()); } else { _target.constantID = EditorGUILayout.IntField(_target.constantID); } if (GUILayout.Button("Copy number")) { EditorGUIUtility.systemCopyBuffer = _target.constantID.ToString(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); if (GUI.changed) { EditorUtility.SetDirty(_target); } }