public static void Release(FormatItem format) { switch (format) { case LiteralText lt: ReleaseLiteralText(lt); break; case Format f: ReleaseFormat(f); break; case Placeholder p: ReleasePlaceholder(p); break; case Selector s: ReleaseSelector(s); break; default: Debug.LogError("Unhandled type " + format.GetType()); break; } }