Version: 1.3
语言 : 中文
OpenHarmony environment settings
OpenHarmony keystores

OpenHarmony Player settings

This page details the Player Settings for the OpenHarmony platform. For a description of the general Player settings, refer to Player Settings.

Player Settings for OpenHarmony.
Player Settings for OpenHarmony.

Descriptions of properties are grouped according to corresponding sections in the Player UI:

Icon

Use the Icon section to specify icons to represent your application on the device.

Icon settings for OpenHarmony.
Icon settings for OpenHarmony.

Resolution and Presentation

Use the Resolution and Presentation section to customize aspects of the screen’s appearance.

Resolution and Presentation settings for OpenHarmony.
Resolution and Presentation settings for OpenHarmony.
Settings Description
Hide Navigation Bar Indicates whether to hide the navigation bar that appears at the top of the window.
Render outside safe area Indicates whether the application should use all available screen space to render, including areas of the display that are cut out (notched). For more information, see OpenHarmony’s display cutout support documentation.

Other Resolution and Presentation settings are grouped under the following sections:

Resolution Scaling

Use the Resolution Scaling section to customize settings relating to screen resolution scaling. Using a resolution lower than the device’s native resolution can improve performance and battery life.

Resolution Scaling settings for OpenHarmony.
Resolution Scaling settings for OpenHarmony.
Settings Description
Resolution Scaling Mode Specifies whether and how the application scales its resolution. You can set the scaling to be equal to or lower than the native screen resolution. Using a lower resolution can improve performance and battery life.
Disabled Doesn’t apply resolution scaling and the application renders to the device’s native screen resolution.
FixedDPI Applies resolution scaling using a target DPI. Use this to optimize performance and battery life or target a specific DPI setting.
Letterboxed Adds black bars to the rendered output so the content doesn’t stretch. This process is called letterboxing.
Target DPI The resolution of the application. If the device’s native screen DPI is higher than this value, Tuanjie downscales the application’s resolution to match this setting. To calculate the scale, Tuanjie uses the following:
min(Target DPI * Factor / Screen DPI, 1)
Where Factor is the Resolution Scaling Fixed DPI Factor from Quality settings.Note: This option only appears when you set Resolution Scaling Mode to Fixed DPI.
Reset resolution on window resize Indicates whether to set the screen resolution to the new native window size when the native window size changes. If you set Resolution Scaling Mode to Fixed DPI, Tuanjie recalculates the resolution based on Fixed DPI property.
Blit Type Controls whether to use a blit to render the final image to the screen. Using a blit is compatible with most devices but is usually slower than not using a blit.
Always Tuanjie renders to an offscreen buffer and then uses a blit to copy the contents of the buffer to the device’s framebuffer. This is compatible with most devices but is usually slower than not using blit.
Never Tuanjie renders to the framebuffer provided by the device’s operating system. If this fails, the application prints a one-time warning to the device log. This is usually faster than using blit, but it isn’t compatible with all devices.
Auto Tuanjie renders to the framebuffer provided by the device’s operating system if possible. If this fails, Tuanjie prints a warning to the device console and uses a blit to render the final image to the screen.

Orientation

Use the Orientation section to customize settings relating to the orientation of the application on the device.

Orientation settings for OpenHarmony.
Orientation settings for OpenHarmony.

Select screen orientation from the Default Orientation drop-down menu:

Settings Description
Default Orientation Specifies the screen orientation the application uses.

Note: Tuanjie shares the value you set for this setting between OpenHarmony and Android.
Portrait The application uses portrait screen orientation where the bottom of the application’s window aligns with the bottom of the device’s screen.
Portrait Upside Down The application uses portrait screen orientation where the bottom of the application’s window aligns with the top of the device’s screen.
Landscape Right The application uses landscape screen orientation where the right side of the application’s window aligns with the bottom of the device’s screen.
Landscape Left The application uses landscape screen orientation where the right side of the application’s window aligns with the top of the device’s screen.
Auto Rotation The screen can rotate to any of the orientations you specify in the Allowed Orientations for Auto Rotation section.

Allowed Orientations for Auto Rotation

Use the Allowed Orientations for Auto Rotation section to specify which orientations the application supports when you set Default Orientation to Auto Rotation. This is useful, for example, to lock the application to landscape orientation but allow the user to switch between landscape left and landscape right.

This section only appears when you set Default Orientation to Auto Rotation.

Allowed Orientations for Auto Rotation settings for OpenHarmony.
Allowed Orientations for Auto Rotation settings for OpenHarmony.
Settings Description
Portrait Indicates whether the application supports portrait screen orientation where the bottom of the application’s window aligns with the bottom of the device’s screen.
Portrait Upside Down Indicates whether the application supports portrait screen orientation where the bottom of the application’s window aligns with the top of the device’s screen.
Landscape Right Indicates whether the application supports landscape screen orientation where the right side of the application’s window aligns with the bottom of the device’s screen.
Landscape Left Indicates whether the application supports landscape screen orientation where the right side of the application’s window aligns with the top of the device’s screen.

Other

The Resolution and Presentation section also contains the following general settings.

Other resolution and presentation settings for OpenHarmony.
Other resolution and presentation settings for OpenHarmony.
Settings Description
Use 32-bit Display Buffer Indicates whether the display buffer holds 32-bit color values instead of 16-bit color values. Enable this setting if you see banding, or need alpha values in Post-processing and full-screen effects. Some post-processing effects require this because they create Render Textures in the same format as the display buffer.
Disable Depth and Stencil Indicates whether to disable depth and stencil buffers.
Render Over Native UI Indicates whether to render on top of native UI on OpenHarmony or Android. For this setting to take effect, set your Camera’s Clear Flags to use a solid color with an alpha value lower than 1.

Splash Image

The following are the general Splash Screen settings that set the OpenHarmony specific Static Splash Image options.

Splash screen settings for OpenHarmony.
Splash screen settings for OpenHarmony.
Settings Description
Image Specifies the texture that the application uses for the OpenHarmony splash screen. The standard size for the splash screen image is 320x480.
Scaling Specifies how to scale the splash image to fit the device’s screen.

Other Settings

This section can be customized with a range of options, divided into the following groups:

Rendering

Use these settings to customize how Tuanjie renders games for the OpenHarmony platform.

Rendering Settings for OpenHarmony
Rendering Settings for OpenHarmony
Settings Description
Color Space Choose which color space should be used for rendering: Gamma or Linear.
Refer to Linear rendering overview for an explanation of the difference between the two.
Auto Graphics API Disable this option to manually pick and reorder the graphics APIs. By default, this option is enabled, and Tuanjie tries to use Vulkan. If the device doesn’t support Vulkan, Tuanjie falls back to GLES3.2, GLES3.1 or GLES3.0.
Important: Tuanjie adds the GLES3/GLES3.1/AEP/3.2 requirement to your OpenHarmony App module.json5 only if GLES2 isn’t in the list of APIs when Auto Graphics API is disabled. In this case only, your application doesn’t appear on unsupported devices in the Google Play Store.
Color Gamut Add or delete Gamut for rendering on OpenHarmony. Click the (+) icon to see the list of available gamuts. A gamut defines the range of colors that a given device (such as a monitor or screen) can use. The sRGB gamut is the default (and required) gamut.
If target device is a newer tvOS device with a wide-gamut display, use DisplayP3 to take full advantage of the display. For older devices, use Metal Editor Support as a fallback.
Multithreaded Rendering Enable this option to use multithreaded rendering. This feature is only supported on Metal.
Static Batching Enable this option to use static batching.
Dynamic Batching Select this checkbox to use Draw Call Batching in building (enabled by default).
Compute Skinning Enable this option to use DX11/DX12/ES3 GPU compute skinning, which frees up CPU resources.
Graphics Jobs (Experimental) Enable this option to instruct Tuanjie to offload graphics tasks (rendering loops) to worker threads running on other CPU cores. This feature is designed to reduce the time spent in Camera.Render on the main thread, which often becomes a bottleneck.
Note: This feature is experimental which may not bring performance improvements to project and may introduce new crashes.
Texture compression format Choose between ASTC, ETC2 and ETC (ETC1 for RGB, ETC2 for RGBA). Refer to texture compression format overview for more information on how to pick the right format.
Refer to Texture compression settings for more details on how this interacts with the texture compression setting in the Build Settings.
Normal Map Encoding Choose either XYZ or DXT5nm style for normal map encoding. This setting affects the encoding scheme and compression format used for normal maps. DXT5nm style normal maps are higher quality, but are more expensive to decode in the shader.
Lightmap Encoding Select Low Quality, Normal Quality, or High Quality to set the lightmap encoding. This setting affects the encoding scheme and compression format of the lightmaps.
HDR Cubemap Encoding Choose Low Quality, Normal Quality, or High Quality to set the HDR Cubemap encoding. This setting affects the encoding scheme and compression format of the HDR Cubemaps.
Lightmap Streaming Enabled Whether to use Mipmap Streaming for lightmaps. Tuanjie applies this setting to all lightmaps when it generates them.
Note: To use this setting, you must enable the Texture Streaming Quality setting.
Streaming Priority Set the priority for all lightmaps in the Mipmap Streaming system. Tuanjie applies this setting to all lightmaps when it generates them.
Positive numbers give higher priority. Valid values range from –128 to 127.
Enable Frame Timing Stats Enable this option to collect CPU/GPU frame timing statistics.
Virtual Texturing Indicates whether to enable Virtual Texturing.
Note: Virtual Texturing isn’t compatible with OpenHarmony.
Shader precision model Controls the default precision of samplers used in shaders. Refer to Shader data types and precision for more details.
Load/Store Action Debug Mode Highlights undefined pixels that may cause rendering problems on mobile platforms. This affects the Tuanjie Editor Game view, and your built application if you select Development Build in Build Settings. Refer to LoadStoreActionDebugModeSettings.
Editor Only Highlights undefined pixels in the Game view in the Editor, but not your built application.

Vulkan Settings

Vulkan Player settings for the OpenHarmony platform
Vulkan Player settings for the OpenHarmony platform
Property Description
SRGB Write Mode Enable this option to allow Graphics.SetSRGBWrite() renderer to toggle the sRGB write mode during runtime. That is, if you want to temporarily turn off Linear-to-sRGB write color conversion, you can use this property to achieve that. Enabling this has a negative impact on performance on mobile tile-based GPUs; therefore, do NOT enable this for mobile.
Number of swapchain buffers Set this option to 2 for double-buffering, or 3 for triple-buffering to use with Vulkan renderer. This setting may help with latency on some platforms, but in most cases you should not change this from the default value of 3. Double-buffering might have a negative impact on performance. Do not use this setting on OpenHarmony.
Acquire swapchain image late as possible If enabled, Vulkan delays acquiring the backbuffer until after it renders the frame to an offscreen image. Vulkan uses a staging image to achieve this. Enabling this setting causes an extra blit when presenting the backbuffer. This setting, in combination with double-buffering, can improve performance. However, it also can cause performance issues because the additional blit takes up bandwidth.
Recycle command buffers Indicates whether to recycle or free CommandBuffers after Unity executes them.
Apply display rotation during rendering Enable this to perform all rendering in the native orientation of the display. This has a performance benefit on many devices. For more information, see documentation on Framebuffer orientation.

Identification

Identification Settings for OpenHarmony
Identification Settings for OpenHarmony
Property Description
Override Default Package Name Indicates whether to override the default package name for your application.
Note: This setting affects macOS, iOS, tvOS, Android and OpenHarmony.
  Package Name Set the application ID, which uniquely identifies your app on the device . The application ID must follow the convention com.YourCompanyName.YourProductName and must contain only alphanumeric and underscore characters. Each segment must start with an alphabetical character.
Important: Tuanjie automatically removes any invalid characters you type.
To set this property, enable Override Default Package Name.
Version Enter the build version number of the bundle, which identifies an iteration (released or unreleased) of the bundle. The version is specified in the common format of a string containing numbers separated by dots (For example, 4.3.2). (Shared between Android and OpenHarmony.)
Bundle Version Code An internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. This isn’t the version number shown to users; that number is set by the versionName attribute. The value must be set as an integer, such as “100”. You can define it however you want, as long as each successive version has a higher number.

For example, it could be a build number. Or you could translate a version number in “x.y” format to an integer by encoding the “x” and “y” separately in the lower and upper 16 bits. Or you could simply increase the number by one each time a new version is released.

Keep this number under 100000 if Split Haps by target architecture is enabled. Each Hap must have a unique version code so Tuanjie adds 100000 to the number for ARMv7, and 200000 for ARM64.

Configuration

Configuration for OpenHarmony
Configuration for OpenHarmony
Property Description
Scripting Backend Choose the scripting backend you want to use. The scripting backend determines how Unity compiles and executes C# code in your Project.
IL2CPP Compiles C# code into CIL, converts the CIL to C++ and then compiles that C++ into native machine code, which executes directly at runtime. For more information, refer to IL2CPP.
API Compatibility Level Choose which .NET APIs you can use in your project. This setting can affect compatibility with third-party libraries. However, it has no effect on Editor-specific code (code in an Editor directory, or within an Editor-specific Assembly Definition).

Tip: If you are having problems with a third-party assembly, you can try the suggestion in the API Compatibility Level section below.
.Net 2.0 .Net 2.0 libraries. Maximum .net compatibility, biggest file sizes. Part of the deprecated .NET 3.5 runtime.
.Net 2.0 Subset Subset of full .net compatibility, smaller file sizes. Part of the deprecated .NET 3.5 runtime.
.Net Standard 2.0 Compatible with .NET Standard 2.0. Produces smaller builds and has full cross-platform support.
.Net 4.x Compatible with the .NET Framework 4 (which includes everything in the .NET Standard 2.0 profile as well as additional APIs). Choose this option when using libraries that access APIs not included in .NET Standard 2.0. Produces larger builds and any additional APIs available are not necessarily supported on all platforms. See Referencing additional class library assemblies for more information.
C++ Compiler Configuration Choose the C++ compiler configuration used when compiling IL2CPP generated code.
Note: This property is disabled unless Scripting Backend is set to IL2CPP.
Use incremental GC Uses the incremental garbage collector, which spreads garbage collection over several frames to reduce garbage collection-related spikes in frame duration. For more information, refer to Automatic Memory Management.
Assembly Version Validation Indicates whether Mono validates types from a strongly-named assembly.
Allow downloads over HTTP Indicates whether to allow downloading content over HTTP. The options are Not allowed, Allowed in Development builds only, and Always allowed. The default option is Not allowed due to the recommended protocol being HTTPS, which is more secure.
Mute Other Audio Sources Enable this option if you want your Unity application to stop Audio from applications running in the background. Otherwise, Audio from background applications continues to play alongside your Unity application.
Target Architectures Select which CPUs you want to allow the application to run on (32-bit ARM, 64-bit ARM, and 64-bit x86–64).
Note: Running OpenHarmony apps in a 64-bit environment has performance benefits and 64-bit apps can address more than 4 GB of memory space.
Split Haps by target architecture (Experimental) Enable this option to create a separate HAP for each CPU architecture selected in Target Architectures.
Internet Access Choose whether to always add the networking (INTERNET) permission to the OpenHarmony App module, even if you are not using any networking APIs. Set to Require by default for development builds.
Auto Only add the internet access permission if you are using a networking API.
Require Always add the internet access permission.
Write Permission Choose whether to enable write access to the external storage (such as the SD card) and add a corresponding permission to the OpenHarmony App Module. Set to External(SDCard) by default for development builds.
Internal Only grant write permission to internal storage.
External(SDCard) Enable write permission to external storage.
Low Accuracy Location Enable this option to use low accuracy values with OpenHarmony location APIs instead.
Active Input Handling Choose how to handle input from users.
Input Manager (old) Use the default Input window.
Input System Package (New) Use the newer Input system. To try the new Input System, install the InputSystem package.
Both Use both systems side by side.

Shader Variant Loading

Use these settings to control how much memory shaders use at runtime.

Settings Description
Default chunk size (MB) Sets the maximum size of compressed shader variant data chunks Unity stores in your built application for all platforms. The default is 16. For more information, refer to Shader loading.
Default chunk count Sets the default limit on how many decompressed chunks Unity keeps in memory on all platforms. The default is 0, which means there’s no limit.
Override Enables overriding Default chunk size and Default chunk count for this build target.
Chunk size (MB) Overrides the value of Default chunk size (MB) on this build target.
Chunk count Overrides the value of Default chunk count on this build target.

API Compatibility Level

You can choose your mono API compatibility level for all targets. Sometimes a third-party .NET library uses functionality that’s outside of your .NET compatibility level. To understand what’s going on in such cases, and how to best fix it, try following these suggestions:

  1. Install ILSpy for Windows.
  2. Drag the .NET assemblies for the API compatibility level that you are having issues with into ILSpy. You can find these under Frameworks/Mono/lib/mono/YOURSUBSET/.
  3. Drag in the third-party assembly.
  4. Right-click the third-party assembly and select Analyze.
  5. In the analysis report, inspect the Depends on section. The report highlights anything that the third-party assembly depends on, but that’s not available in the .NET compatibility level of your choice in red.

Script Compilation

Script Compilation for OpenHarmony
Script Compilation for OpenHarmony
Property Description
Scripting Define Symbols Sets custom compilation flags.

For more details, see Platform dependent compilation.
Additional Compiler Arguments Adds entries to this list to pass additional arguments to the Roslyn compiler. Use one new entry for each additional argument.
To create a new entry, click Add (+). To remove an entry, click Remove (-).

When you have added all desired arguments, click Apply to include your additional arguments in future compilations. Click Revert to reset this list to the most recent applied state.
Suppress Common Warnings Indicates whether to display the C# warnings CS0169 and CS0649.
Allow ‘unsafe’ Code Enables support for compiling ‘unsafe’ C# code in a pre-defined assembly (for example, Assembly-CSharp.dll).
For Assembly Definition Files (.asmdef), click on one of your .asmdef files and enable the option in the Inspector window that appears.
Use Deterministic Compilation Indicates whether to prevent compilation with the -deterministic C# flag. With this setting enabled, compiled assemblies are byte-for-byte identical each time they are compiled.

For more information, see Microsoft’s deterministic compiler option.
Enable Roslyn Analyzers Indicates whether to compile user-written scripts without Roslyn analyzer DLLs that might be present in your project.

Optimization

Optimization for OpenHarmony
Optimization for OpenHarmony
Property Description
Prebake Collision Meshes Adds collision data to Meshes at build time.
Preloaded Assets Sets an array of Assets for the player to load on startup.
To add new Assets, increase the value of the Size property and then set a reference to the Asset to load in the new Element box that appears.
Strip Engine Code Enable this option if you want the Unity Linker tool to remove code for Unity Engine features that your Project doesn’t use. This setting is only available with the IL2CPP scripting backend.

Most apps don’t use every available DLL. This option strips out DLLs that your app doesn’t use to reduce the size of the built Player. If your app is using one or more classes that would normally be stripped out under your current settings, Unity displays a debug message when you try to build the app.
Managed Stripping Level Chooses how aggressively Unity strips unused managed (C#) code. The options are Minimal, Low, Medium, and High.
When Unity builds your app, the Unity Linker process can strip unused code from the managed DLLs your Project uses. Stripping code can make the resulting executable significantly smaller, but can sometimes accidentally remove code that’s in use.

For more information about these options and bytecode stripping with IL2CPP, refer to ManagedStrippingLevel.
Vertex Compression Sets vertex compression per channel. This affects all the meshes in your project.
Typically, Vertex Compression is used to reduce the size of mesh data in memory, reduce file size, and improve GPU performance.

For more information on how to configure vertex compression and limitations of this setting, refe to Compressing mesh data.
Optimize Mesh Data Enable this option to strip unused vertex attributes from the mesh used in a build. This option reduces the amount of data in the mesh, which can help reduce build size, loading times, and runtime memory usage.

Warning: If you have this setting enabled, you should remember to not change material or shader settings at runtime.

For more information, refer to PlayerSettings.stripUnusedMeshComponents.
Texture MipMap Stripping Enables mipmap stripping for all platforms. This strips unused mipmaps from Textures at build time. Unity determines unused mipmaps by comparing the value of the mipmap against the Quality Settings for the current platform. If a mipmap value is excluded from every Quality Setting for the current platform, then Unity strips those mipmaps from the build at build time. If QualitySettings.masterTextureLimit is set to a mipmap value that has been stripped, Unity will set the value to the closest mipmap value that has not been stripped.

Logging

Select the type of logging allowed in a specific context.

Logging Settings for OpenHarmony
Logging Settings for OpenHarmony
  • Select your preferred stack trace method by enabling the option that corresponds to each Log Type (Error, Assert, Warning, Log, and Exception) based on the type of logging you require. For example:
    • ScriptOnly: Logs only when running scripts.
    • Full: Logs all the time.
    • None: No logs are ever recorded.

See stack trace logging for more information.

Legacy

Enable the Clamp BlendShapes (Deprecated) option to clamp the range of blend shape weights in in SkinnedMeshRenderers.

Legacy for OpenHarmony
Legacy for OpenHarmony

Publishing Settings

Use the Publishing Settings to configure how Tuanjie builds your OpenHarmony app. To open the Publishing Settings, go to Edit > Project Settings, select Player, select the OpenHarmony icon, and open the Publishing Settings panel.

This section describes the different sections of the Publishing Settings panel and their functions. These resources include:

OpenHarmony Publish Windows
OpenHarmony Publish Windows

Note: For security reasons, Tuanjie does not save keystore or project key passwords.

Use the Keystore Manager window to create, configure and load your keys and keystores. You can load existing keystores and keys from either the Keystore Manager or the main OpenHarmony Publishing panel. If you choose to load these from inside the Keystore Manager, Tuanjie automatically fills the Project Keystore and Project Key fields. For further information, refer to the documentation on the Keystore Manager.

Project Keystore

A keystore is a container that holds signing keys for application security. For details, refer to OpenHarmony developer documentation: OpenHarmony keystore system.

Use the Project Keystore settings to choose which keystore to use for the open project. When you load a keystore, Tuanjie loads all the keys in that keystore. To load and use an existing keystore in your open project:

  1. Enable Custom Keystore
  2. Open the Select drop-down list, select Browse, and then select the keystore from your file system.
  3. Enter Keystore password. If the password is correct, it will be automatically filled in the Key alias and Key password text boxes.
  4. Use the certificate request file (.csr) to apply for the certificate and profile file on AppGallery Connect and download and save them locally. The certificate request file (.csr) and keystore file (.p12) are files of the same name generated and stored together through Keystore Manager.
  5. In Profile file and Certificate file, select the profile file (.p7b) and certificate file (.cer) downloaded in the previous step.

If you don’t have an existing keystore, leave Custom Keystore disabled.

Tuanjie uses a debug keystore to sign your application. A debug keystore is a working keystore. It allows you to sign the application and to test it locally. However, the app store will decline apps signed in this way. This is because the app store is unable to verify the validity and ownership of the application using a debug keystore.

Property Description
Custom Keystore Enable Custom Keystore to load and use an existing keystore.
Select When Custom Keystore is enabled, use this to select the keystore you want to use. The keystores below the partition in the Select dropdown are stored in a predefined dedicated location. For more details, see Choose the keystore location.
Path You don’t need to enter your keystore path. Tuanjie provides this based on the keystore you choose.
Password Enter the keystore password to load the selected keystore.
Property Description
Alias Select the keystore you want to use to open the project.
Password Enter the keystore password.
OpenHarmony environment settings
OpenHarmony keystores