private void SetTarget() { // When switching target if (target != targetBloc || targetBloc == null) { targetBloc = target as ContourBloc; ContourBlocBuilder attachedBuilder = targetBloc.GetComponent <ContourBlocBuilder>(); createContourMode = false; CorrectPointSelectionArrayLengths(); CorrectContourSelectionArrayLengths(); } }
private void Reset() { bloc = GetComponent <ContourBloc>(); foreach (ContourBlueprint bp in GetComponents <ContourBlueprint>()) { DestroyImmediate(bp); } foreach (ContourBuilder b in GetComponentsInChildren <ContourBuilder>()) { if (b != null && b.gameObject != null) { DestroyImmediate(b.gameObject); } } RebuildAll(); }
public override void OnInspectorGUI() { // When bloc is defined, contour are set by the ContourBloc component if (targetBuilder.bloc != null) { GUI.enabled = false; } DrawDefaultInspector(); GUI.enabled = true; // Set bloc and palette EditorGUI.BeginChangeCheck(); ContourBloc bloc = EditorGUILayout.ObjectField("Bloc", targetBuilder.bloc, typeof(ContourBloc), true) as ContourBloc; if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Set bloc"); targetBuilder.bloc = bloc; EditorUtility.SetDirty(targetBuilder); } EditorGUI.BeginChangeCheck(); ContourPalette palette = targetBuilder.palette = EditorGUILayout.ObjectField("Palette", targetBuilder.palette, typeof(ContourPalette), true) as ContourPalette; if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Set palette"); targetBuilder.palette = palette; EditorUtility.SetDirty(targetBuilder); } // Edit blueprints showBlueprintList = EditorGUILayout.Foldout(showBlueprintList, "Blueprints"); if (showBlueprintList) { EditorGUI.indentLevel++; // Show blue prints as a list, integrated in this inspector ContourListInspectorGUI(); // Option to show all blueprints as individual components //EditorGUI.BeginChangeCheck(); //showBluePrintComponents = EditorGUILayout.Toggle("Show components", showBluePrintComponents); //if (EditorGUI.EndChangeCheck()) SetBlueprintsVisible(showBluePrintComponents); EditorGUI.indentLevel--; } else { SetBlueprintsVisible(false); } }