public bool RenderObjectProperties(GUIContent label) { bool dataChanged = false; if (label == null) { label = new GUIContent(); } label.text += " (" + this + ")"; _editorFoldout = EditorGUILayout.Foldout(_editorFoldout, label); if (_editorFoldout) { int origIndent = EditorGUI.indentLevel; EditorGUI.indentLevel++; eEditorType editorType = (eEditorType)EditorGUILayout.EnumPopup("Position Type", _editorType); if (_editorType != editorType) { _editorType = editorType; _pathNode = new ComponentRef <PathNode>(); _path = new ComponentRef <Path>(); _pathT = 0.0f; dataChanged = true; } switch (_editorType) { case eEditorType.Node: { _pathNode = SerializationEditorGUILayout.ObjectField(_pathNode, new GUIContent("Path Node"), ref dataChanged); } break; case eEditorType.PathT: { _path = SerializationEditorGUILayout.ObjectField(_path, new GUIContent("Path"), ref dataChanged); EditorGUI.BeginChangeCheck(); _pathT = EditorGUILayout.Slider(_pathT, 0.0f, 1.0f); if (EditorGUI.EndChangeCheck()) { dataChanged = true; } } break; } EditorGUI.indentLevel = origIndent; } return(dataChanged); }
public void OnAfterDeserialize() { #if UNITY_EDITOR _editorType = _pathNode.GetComponent() != null ? eEditorType.Node : eEditorType.PathT; #endif }