-
Notifications
You must be signed in to change notification settings - Fork 106
Add doc for targeting the supported platforms #638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kring
wants to merge
5
commits into
main
Choose a base branch
from
platform-doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+127
−10
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # Change Log | ||
| # Change Log {#changes} | ||
|
|
||
| ## v1.20.0 - 2025-12-01 | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Contributor Guide {#contributor-guide} | ||
|
|
||
| This section contains topics that are useful to anyone building Cesium for Unity themselves, modifying it, or contributing to it. For information about using the plugin, see the [User Guide](#user-guide). | ||
|
|
||
| - \subpage developer-setup | ||
| - \subpage reinterop | ||
| - \subpage creating-monobehaviours | ||
| - \subpage release-guide | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| # Supported Platforms {#supported-platforms} | ||
|
|
||
| Cesium for Unity makes use of native code - not just C# code - which means that it must be compiled for each platform on which it runs. The Cesium for Unity release packages include pre-built binaries for a number of platforms. | ||
|
|
||
| The following platforms are currently supported: | ||
|
|
||
| - [Windows](#windows) | ||
| - [macOS](#macos) | ||
| - [Android / Meta Quest](#android) | ||
| - [iOS](#ios) | ||
| - [Universal Windows Platform](#uwp) | ||
| - [Web](#web) | ||
| - [Others?](#others) | ||
|
|
||
| ## Windows {#windows} | ||
|
|
||
| Cesium for Unity supports Windows as both a Unity Editor and Player platform. See the [Unity Windows](https://docs.unity3d.com/Manual/Windows.html) documentation for general information about develping Unity applications for the Windows platform. | ||
|
|
||
| Cesium for Unity requires an x86-64 processor on Windows; ARM64 is not currently supported. Most versions of Windows that can run Unity should be able to run Cesium for Unity as well. | ||
|
|
||
| ## macOS {#macos} | ||
|
|
||
| Cesium for Unity supports macOS as both a Unity Editor and Player platform. See the [Unity macOS](https://docs.unity3d.com/Manual/AppleMac.html) documentation for general information about develping Unity applications for the macOS platform. | ||
|
|
||
| Cesium for Unity runs natively on both Intel x86-64 and Applie Silicon (M1, M2, M3, M4, M5, etc.) processors, and on macOS 10.15+. | ||
|
|
||
| ## Android / Meta Quest {#android} | ||
|
|
||
| Cesium for Unity supports Android and Meta Quest as a Unity Player platforms. See the [Unity Android](https://docs.unity3d.com/Manual/android.html) documentation for general information about develping Unity applications for the Android platform. | ||
|
|
||
| Cesium for Units supports both Intel x86-64 and ARM64 processors. Most Android devices use ARM64, but the x86-64 support is important to support the Magic Leap 2 device. 32-bit Android devices with ARMv7 processors are _not_ supported. | ||
|
||
|
|
||
| The Android Player Settings must be configured as follows: | ||
|
|
||
| | *Setting* | *Value* | | ||
| |-----------|---------| | ||
| | Scripting Backend | `IL2CPP` | | ||
| | Target Architectures | `ARM64` _or_ `x86-64`, _not_ `ARMv7` | | ||
| | Internet Access | `Require` | | ||
|
|
||
| ## iOS {#ios} | ||
|
|
||
| Cesium for Unity supports iOS as a Unity Player platform. See the [Unity iOS](https://docs.unity3d.com/Manual/iphone.html) documentation for general information about developing Unity applications for the iOS platform. | ||
|
|
||
| ## Universal Windows Platform {#uwp} | ||
|
|
||
| Cesium for Unity supports Universal Windows Platform (UWP) as a Unity Player platform. This is most useful when targetting HoloLens devices, but it can also be used to build desktop applications. | ||
|
|
||
| Both the "Intel 64-bit" and "ARM 64-bit" architectures are supported. 32-bit platforms are _not_ supported. | ||
|
|
||
| Be sure that the `InternetClient` capability is enabled in the Player Settings. | ||
|
|
||
| ## Web {#web} | ||
|
|
||
| Cesium for Unity supports the Web as a Unity Player platform. Both WebGL and WebGPU are supported. Unity 6 or later is required. See the [Unity Web](https://docs.unity3d.com/Manual/webgl.html) documentation for general information about developing Unity applications for the Web. | ||
|
|
||
| You _must_ turn on "Enable Native C/C++ Multithreading" in the Player Settings. If you don't, you will see errors like this at build time: | ||
david-lively marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| > wasm-ld: error: Library/PackageCache/com.cesium.unity@57778A6EB39E/Plugins/WebGL/libCesiumForUnityNative-Runtime.a(CesiumCreditSystem.cpp.o): undefined symbol: __wasm_lpad_context | ||
| wasm-ld: error: Library/PackageCache/com.cesium.unity@57778A6EB39E/Plugins/WebGL/libCesiumForUnityNative-Runtime.a(CesiumCreditSystem.cpp.o): undefined symbol: _Unwind_CallPersonality | ||
|
|
||
| When using the "Build and Run" button in the Unity Editor, Unity starts a simple web server to host your web application, and this works great for testing. To host the built application on your own web server, however, you need to ensure that the proper HTTP response headers are set. As explained in the [Unity documentation](https://docs.unity3d.com/Manual/webgl-technical-overview.html#multithreading-support), these required response headers are: | ||
|
|
||
| * `Cross-Origin-Opener-Policy: same-origin` | ||
| * `Cross-Origin-Embedder-Policy: require-corp` | ||
| * `Cross-Origin-Resource-Policy: cross-origin` | ||
|
|
||
| Failure to set these headers will result in a popup when the application loads saying, "Your web browser does not support multithreading." | ||
|
|
||
| Your custom web server must also be configured to serve files with the extension `.br` with the following response header: | ||
|
|
||
| * `Content-Encoding: br` | ||
|
|
||
| If this header is missing, the web page will display an error explaining that this needs to be done. If this is difficult to arrange, you can avoid the need by enabling the `Decompression Fallback` option in the Player Settings. However, this will increase startup time. | ||
|
|
||
| ## Others? {#others} | ||
|
|
||
| Cesium for Unity's native code is quite portable, so building it for other platforms should be possible. However, it is _not_ possible to target other platforms when using the released Cesium for Unity packages. Instead, you will need to build it from the source code on [GitHub](https://github.com/CesiumGS/cesium-unity). | ||
|
|
||
| The basic steps are as follows: | ||
|
|
||
| 1. Make sure you're able to build and run Cesium for Unity for the Unity Editor on your development machine by following the [Developer Setup Instructions](#developer-setup). If you're trying to run the Editor on a previously-unsupported platform, you will need to adapt these steps for your platform. | ||
| 2. Add the new platform to the list of `SupportedPlatforms` near the top of [Build~\Package.cs](https://github.com/CesiumGS/cesium-unity/blob/main/Build~/Package.cs). This is the name that is used to refer to the platform on the command-line. | ||
| 3. Add new code to the `Run` method in that same file to launch Unity and build it for the new platform. Copy an existing platform and modify it as appropriate. | ||
| 4. Add a new function for your platform to [Editor/BuildCesiumForUnity.cs](https://github.com/CesiumGS/cesium-unity/blob/main/Editor/BuildCesiumForUnity.cs), again copying an existing platform as appropriate. | ||
| 5. The hardest part: Modify [Editor/CompileCesiumForUnityNative.cs](https://github.com/CesiumGS/cesium-unity/blob/main/Editor/CompileCesiumForUnityNative.cs) to teach it how to compile the native code for your platform. Again, it's usually easiest to start with a similar platform, copy it, and modify as appropriate. | ||
| 6. Modify the two `ConfigureReinterop.cs` files, adding a new `#if`-protected `CppOutputPath` for your platform. Here the `UNITY_*` symbols must match the names Unity uses for the platform. | ||
|
|
||
| If all that works flawlessly (good luck!) you will be able to build a player for your new platform from the Editor UI, and it will build the native code to go with it. You can also build from the command-line by running something like: | ||
|
|
||
| ``` | ||
| dotnet run --project Build~ package --platform MyNewPlatform | ||
| ``` | ||
|
|
||
| Where `MyNewPlatform` is the name used in step (2). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # User Guide {#user-guide} | ||
|
|
||
| This section contains topics that are useful to anyone using Cesium for Unity. See the [Contributor Guide](#contributor-guide) for information about building, modifying, and contributing to the plugin itself. | ||
|
|
||
| > [!note] | ||
| > In addition to the topics below, please see the [tutorials](https://cesium.com/learn/unity/) on the Cesium web site. | ||
|
|
||
| - \subpage supported-platforms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.