public static T IDToField <T>(T field, int _constantID) where T : Transform { T newField = field; if (_constantID != 0) { newField = Serializer.returnComponent <T>(_constantID); if (newField != null) { field = newField; } 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); }
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); }