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 SetTargetDirty()
    {
        // Set target and attached builder dirty
        if (targetBloc == null)
        {
            return;
        }
        EditorUtility.SetDirty(targetBloc);
        ContourBlocBuilder targetBuilder = targetBloc.GetComponent <ContourBlocBuilder>();

        if (targetBuilder == null)
        {
            return;
        }
        EditorUtility.SetDirty(targetBuilder);
    }
    private void OnUndoRedo()
    {
        // Ensure selection doesn't create error
        ClearContourSelection();
        ClearPointSelection();
        // Update target
        SetTarget();
        SetTargetDirty();
        // Update ContourBuilder
        ContourBlocBuilder targetBuilder = targetBloc.GetComponent <ContourBlocBuilder>();

        if (targetBuilder != null)
        {
            targetBuilder.RebuildAll();
        }
    }
    private void RecordUndo(string undoName)
    {
        // Record target and attached builder for undo
        if (targetBloc == null)
        {
            return;
        }
        ContourBlocBuilder targetBuilder = targetBloc.GetComponent <ContourBlocBuilder>();

        if (targetBuilder == null)
        {
            Undo.RecordObject(targetBloc, undoName);
        }
        else
        {
            Undo.RecordObjects(new UnityEngine.Object[] { targetBloc, targetBuilder }, undoName);
        }
    }
 private void OnEnable()
 {
     targetBuilder = target as ContourBlocBuilder;
     //SetBlueprintsVisible(false);
 }