In Cesium for Unreal you can copy a CesiumCartographicPolygon to the clipboard, paste it in a text editor, modify its coordinates and then paste it back into Unreal.
We are planning to use this in the 3D Tiles export from our tool Remoscape, so that the user can paste the contents of a text file from the export into Unreal and connect the resulting polygon to a polygon raster overlay on the Cesium World Terrain to cut a hole for our highres inset.
Is there a similar way of importing a cartographic polygon into Cesium for Unity somehow?
I deleted my previous response because I misunderstood your question, sorry about the noise.
I’m afraid we haven’t tried this before in Cesium for Unity. I know that Unreal uses text to copy and paste, but I’m not sure how contents are actually copied in Unity.
There seems to be a way to detect a “Paste” operation in Unity here:
But I don’t know what the actual event information contains, so I can’t advise beyond that.
Maybe some of these Unity forum threads / documentation could help too:
As an alternative solution, it’s also worth modifying the plugin to allow polygons to be generated from a set of points at runtime.
At the moment, the Spline of the CesiumCartographicPolygon is marked private in C# code (and I’m not sure why I made this choice back then.) But you could modify the plugin so that it’s exposed, such that you could build it from a set of points at runtime. That might be a more feasible solution, rather than trying to deduce Unity’s obscure editor API.
Thanks Janine. This may very well be a solution later on when we have the resources. If we can’t find an easier way right now I guess we’ll just instruct our users to enter exact local coordinates of the polygon, which seems possible in Unity but not in Unreal.
One more idea: In Unity, .unity scene files are simply text files. I don’t know if this format is documented anywhere, but it’s not too hard to understand by looking at it. So you could probably programmatically add objects to it. Or, even better, you could generate a prefab asset, which is a separate file, rather than trying to modify the user’s scene file.