I fixed the problem with the cam2core on the core2. So the UnitCam will work with Arduino IDE code and the core2.

It is a very simple fix:
Replace the first line #include <M5Stack.h>
with #include <M5Core2.h>

Initialising the core code on a Core2 is not the best idea!
Now it works on my Core2 showing the video stream from a UnitCam connected to PortB (pins 26, 36).