I can see that figures work without any error within theorem environments defined with the amsthm package, but it does not work in tcolorbox theorem environments. Rather, it throws the error "! LaTeX Error: Float(s) lost." Why is this so? Also, how would I work around this? Here's a minimal example
\documentclass[12pt, letter]{article}
\usepackage{amsthm}
\usepackage{tikz}
\usepackage{tcolorbox}
\newtheorem{thm}{Theorem}
\tcbuselibrary{theorems}
\newtcbtheorem[number within=section]{mytheo}{My Theorem}%
{colback=green!5, colframe=green!35!black, fonttitle=\bfseries}{th}
\begin{document}
\begin{thm}
Test.
\begin{figure}[h]
\caption{An empty figure}
\centering
Test.
\end{figure}
\end{thm}
\begin{mytheo}{Title}{stuff}
ASDF testing stuff!!!
\begin{figure}[h]
\caption{An empty figure}
\centering
Test.
\end{figure}
\end{mytheo}
\end{document}