What happened?
Heya everyone,
as the title describes setting CesiumGeoJsonDocument for CesiumGeoJsonDocumentRasterOverlay.document during runtime, causes a Uncaught RuntimeError: memory access out of bounds in the Browser for WebGL builds.
The same is true when using CesiumGeoJsonDocumentRasterOverlay.source = CesiumGeoJsonDocumentRasterOverlaySource.FromUrl.
Furthermore, adding a CesiumGeoJsonDocumentRasterOverlay Component to the GameObject of the 3D Tileset and setting CesiumGeoJsonDocumentRasterOverlaySource.FromUrl in the editor (and leaving away all runtime logic) does NOT mitigate this issue.
I have tested this behaviour in multiple Browsers in a fresh Unity Project.
Here is a minimal script that can be added to an empty GameObject in a minimal scene to trigger the bug:
using CesiumForUnity;
using UnityEngine;
public class TestScript : MonoBehaviour
{
private const string ClippingKey = "Clipping";
// Test GeoJson authored in QGis
private string geoJson = @"
{
""type"": ""FeatureCollection"",
""name"": ""sm_beach_test"",
""crs"": { ""type"": ""name"", ""properties"": { ""name"": ""urn:ogc:def:crs:OGC:1.3:CRS84"" } },
""features"": [
{ ""type"": ""Feature"", ""properties"": { ""id"": null }, ""geometry"": { ""type"": ""MultiPolygon"", ""coordinates"": [ [ [ [ -118.502622339460956, 34.016051530590985 ], [ -118.502846531725368, 34.015883123181212 ], [ -118.503161802097196, 34.016161866299022 ], [ -118.503498090493878, 34.015917966120988 ], [ -118.503168808105499, 34.015662450897175 ], [ -118.503631204650844, 34.015337248590988 ], [ -118.504640069840818, 34.016219937666698 ], [ -118.504275757411122, 34.01648706544637 ], [ -118.504002523088829, 34.016643857447306 ], [ -118.50360318061783, 34.016678700074841 ], [ -118.503308928270769, 34.016655471658069 ], [ -118.502622339460956, 34.016051530590985 ] ] ] ] } }]
}
";
// A place somehwere at Santa Monica Beach
private double lat = 34.0132d;
private double lon = -118.5d;
private double alt = 25d;
public CesiumGeoreference geoRef;
public Cesium3DTileset googleTileset;
void Start()
{
geoRef.latitude = lat;
geoRef.longitude = lon;
geoRef.height = alt;
CesiumGeoJsonDocument document = CesiumGeoJsonDocument.Parse(geoJson);
CesiumGeoJsonDocumentRasterOverlay overlay = googleTileset.gameObject.AddComponent<CesiumGeoJsonDocumentRasterOverlay>();
overlay.source = CesiumGeoJsonDocumentRasterOverlaySource.FromDocument;
overlay.materialKey = ClippingKey;
overlay.document = document; // <--- Crash occurs when setting the document!
}
}
Environment
Cesium for Unity version: 1.23.2
Unity Editor Version: 6000.4.4f1
Operating System: Win11
Browser: Chromium, Firefox
Reproduction steps
- Setup Cesium for Unity (for Web) following the official guideline
- Setup a scene with Light, Camera, CesiumGeoReference and Google Photorealistic 3D Tiles.
- Add the script above as a Component to an empty GameObject and wire up the necessary references in the Editor.
- Build for WebGL (using Build & Run OR by building & self-hosting)
- Launch Website and witness the crash.
Supporting evidence
No response
What happened?
Heya everyone,
as the title describes setting
CesiumGeoJsonDocumentforCesiumGeoJsonDocumentRasterOverlay.documentduring runtime, causes a Uncaught RuntimeError: memory access out of bounds in the Browser for WebGL builds.The same is true when using
CesiumGeoJsonDocumentRasterOverlay.source = CesiumGeoJsonDocumentRasterOverlaySource.FromUrl.Furthermore, adding a
CesiumGeoJsonDocumentRasterOverlayComponent to the GameObject of the 3D Tileset and settingCesiumGeoJsonDocumentRasterOverlaySource.FromUrlin the editor (and leaving away all runtime logic) does NOT mitigate this issue.I have tested this behaviour in multiple Browsers in a fresh Unity Project.
Here is a minimal script that can be added to an empty GameObject in a minimal scene to trigger the bug:
Environment
Cesium for Unity version: 1.23.2
Unity Editor Version: 6000.4.4f1
Operating System: Win11
Browser: Chromium, Firefox
Reproduction steps
Supporting evidence
No response