CesiumGS / cesium-unreal

Bringing the 3D geospatial ecosystem to Unreal Engine
https://cesium.com/platform/cesium-for-unreal/
Apache License 2.0
921 stars 295 forks source link

Fix bad_any_cast errors by disabling RTTI when building cesium-native #1468

Closed kring closed 2 months ago

kring commented 3 months ago

Fixes #1380

We're seeing bad_any_cast exceptions when loading tilesets with metadata, in release builds, on every platform except Windows. The cause appears to be that cesium-native is compiled with runtime type information (RTTI) enabled, but Cesium for Unreal - as required by Unreal Engine itself - is compiled with RTTI disabled. Windows isn't fussed about this, but apparently it causes subtle problems on Linux/Android/Apple.

kring commented 3 months ago

This PR also includes a bug fix to the GetInteger64 metadata functions on non-Windows platforms. None of them were working because on 64-bit clang platforms (definitely Linux, pretty sure about the others):

Both are 64-bit and seemingly identical. But they're different types, so IsMetadataInteger<int64> evaluates to false. :upside_down_face:

So this PR makes sure we use int64_t instead of int64 when instantiating cesium-native's type traits templates.

j9liu commented 2 months ago

Thanks @kring !