ULdepth does not change space in equation

\documentclass{scrartcl}
\usepackage{mathtools} 
\usepackage{ulem} 
\setlength\ULdepth{20pt}
\begin{document} 
\begin{equation*} 
\uline{A \cdot B =
\begin{bmatrix*}[r]
        6 & -12 \\
        14 & 4    
\end{bmatrix*}\rule[-15pt]{0pt}{0pt}} 
\end{equation*}

\end{document}

enter image description here


You can always \addstackgap befor ethe \uline. Here, macrofied as

\Uline[<extra depth>]{<math content>}.

\documentclass{scrartcl}
\usepackage{mathtools,stackengine} 
\usepackage{ulem} 
\setlength{\ULdepth}{20pt}
\newcommand\Uline[2][3pt]{\uline{\ensurestackMath{\addstackgap[#1]{#2}}}}
\begin{document} 
\begin{equation*} 
\Uline{A \cdot B =%
\begin{bmatrix*}[r]
6 & -12 \\
14 & 4    
\end{bmatrix*}}\qquad
\Uline[6pt]{A \cdot B =%
\begin{bmatrix*}[r]
6 & -12 \\
14 & 4    
\end{bmatrix*}}
\end{equation*}
\end{document}

enter image description here

Note: the argument to \Uline will be set in \textstyle unless \displaystyle is explicitly invoked (though I could automate it, were it vital to the answer).