Getting Started
Unity Package Types
Components
Economy
Scripting
Guidelines
Support
Background
Spatial Unity SDK > Editor > Scripts > Utilities > AssetImportUtility.cs
Released version: 0.67.0 (July 12, 2023)
- Spatial spaces experience app crashes on mobile devices due to high memory usage.
- Room loading time is influenced by the room size.
- By adjusting the compression settings, the size of the room can be significantly reduced. This import utility is expected to reduce the room size by over 50%.
Possible Issues
Issue: Lightmap results are unsatisfactory.
- Select the lightmap texture and go to WebGL settings in the inspector.
- Choose the
RGBA Compressed DXT5|BC3
format under the Format option. - Click Apply to apply the changes.
- ⚠️ Keep in mind that
Crunched DXT
has a significantly smaller size (15%) compared toCompressed DXT
. In some cases, prioritizing smooth performance may be preferable over preserving every detail. - 🚫 Avoid using ASTC on WebGL as it is intended for mobile browsers. Unity will convert the textures again during runtime, leading to significant loading times. (Using ASTC is highly recommended for mobile platforms such as Android and iOS.)
Issue: The appearance of particles has changed.
- Reach out to Spatial support (wonkee@spatial.is) to report the issue.
- Try adjusting the texture settings by using formats with alpha (DXT5) or without alpha (DXT1) to see if it resolves the issue.
- If the problem persists, Spatial support will provide further assistance to resolve these unintended changes.
Issue: Terrain appears shiny
- Go to the platform settings and choose a texture format that does not include an alpha channel (RGB, not RGBA). Note that the AssetImportSettings will automatically detect the presence of alpha and choose the appropriate format accordingly.
- Details: If a texture does not have alpha but is using a format that includes alpha, it will always appear white. And Unity Terrain layer will utilize it for smoothness, resulting in a glossy appearance. (Unity won’t use alpha if the format doesn’t include alpha)
- Details: ASTC is the recommended format for mobile devices. However, as ASTC contains alpha, it can still result in the same issue. As an alternative, you can choose DXT1. Please note that selecting DXT1 will lead to a larger file size compared to ASTC. If you have experience with texture processing, you can manually add a smoothness value to the alpha channel of the texture. Alternatively, you can utilize this utility to help you achieve the desired outcome.
Issue: Scripts that read textures or meshes no longer function properly.
- Select the texture or model in the project and enable the Read/Write option.
- ⚠️ Note that enabling Read/Write will result in a doubling of the memory size.
Important Information to Consider
Texture Formats for Different Platforms
Each platform has its own supported texture formats, allowing you to optimize your project based on specific platform requirements. When selecting a texture, you have the ability to override the default format for each platform. If you haven't made any custom settings, the Creator Toolkit will automatically enable the recommended format for optimal performance.
Recommended Texture Formats
- ASTC (Adaptive Scalable Texture Compression) is widely regarded as the best texture format for mobile devices due to its high-quality output and efficient compression rate. ASTC supports different compression sizes, and we recommend using ASTC8x8 as the primary option. If you find the quality is not satisfactory, you can experiment with ASTC6x6 or ASTC4x4. However, keep in mind that ASTC4x4, while maintaining image fidelity, results in larger file sizes.
- However, for WebGL, the DXT (Block Compression, BC) format is recommended. Although Unity WebGL offers ASTC options in the format list, they are specifically intended for mobile browsers, and Spatial does not support mobile web. Using ASTC formats in WebGL will cause Unity to convert the textures during loading, resulting in significant loading times.
For a 1024x1024 texture with mipmaps:
ASTC4x4: 1.3mb ASTC6x6: 0.6mb ASTC8x8: 341.4kb
Crunched DXT provides a good compression rate despite lower quality, making it a preferred choice for WebGL. The reduced file size translates to shorter loading times, improved performance, and reduced app crashes. If Crunched DXT produces noticeable artifacts, especially in lightmaps, you can consider using Compressed DXT for better quality. (But it may increase the texture size by 3~4 times.)
DXT1 is for RGB textures. If the texture contains alpha channel, then DXT5 should be used as it supports the alpha data.
Details
How the utility works
If asset import settings have already been configured previously, the utility will not make any changes. Therefore, if the default settings applied by the utility are not satisfactory, you have the option to modify the settings manually.
Imported Assets from AssetStore
When importing assets from the Unity AssetStore, the utility will not modify the settings as they have been preconfigured. If the settings are set to high quality or poorly optimized, it can result in a larger file size for the environment. To address this, you can manually adjust the settings using the buttons available in the Utilities tab of the Spatial Portal.
- The "Optimize Assets" button will modify the import settings for all assets in the project.
- The "Optimize Assets (Folder)" button will modify the import settings for assets located within the selected folder.
Feel free to use these manual optimization options to adjust the import settings as needed for your project.
← Previous
- Background
- Possible Issues
- Issue: Lightmap results are unsatisfactory.
- Issue: The appearance of particles has changed.
- Issue: Terrain appears shiny
- Issue: Scripts that read textures or meshes no longer function properly.
- Important Information to Consider
- Texture Formats for Different Platforms
- Recommended Texture Formats
- Details
- How the utility works
- Imported Assets from AssetStore