Frequently Asked Questions
Question: Why do the models in the game turn purple when running the game in offline or online mode in the editor?
If the selected build target when building the AssetBundle is Android, and the default rendering mode of the editor on Windows operating system is DX11, you need to modify the rendering mode of the editor. You can modify the editor's rendering mode by using UnityHub, refer to the official documentation.
For the editor built with Vulkan, you need to add the command -force-vulkan.
For the Windows platform, add the command: -force-gles
Question: The models or materials on the actual device are not displayed correctly
- Make sure that shader variants have been collected and that the SVC file is included in the build.
- Try disabling the Optimize Mesh Data option in the Optimization section of the Project Settings -> Player page.
- If Unity3D is version 2020.3 or above, try using SBP (Scriptable Build Pipeline) for the build.
- Make sure that the shader features used are supported by the tested hardware on the actual device.
- Make sure that the rendering component code is not being stripped by the engine.
- If it is a lighting texture error, check the relevant settings.
- Look for clues in the error log or warning log.
Question: When testing incremental packaging in the editor, the download count is shown as 0
For the test project of the space fighter, I first built the initial version 100, and then copied the resource files to the resource server.
Then I made some modifications to test the update, and the packaged version is 101, and then I copied the resource files to overwrite the resource server.
When running the editor, I observed a key log: the number of resources to be downloaded is shown as 0.
资源包初始化成功!当前资源版本:100
已获取到最新版本号:101
需要下载的资源数量:0
One possibility is:
This is because when building for the first time, the Copy Buidin File Option in the resource package build interface is set to Clear And Copy All. When building later, this option remains unchanged, resulting in the StreamingAssets directory in the editor containing all the latest resource packages.
Another possibility is:
The class implementing IQueryServices always returns true for the query method. You can use the query class of the space fighter.
When checking for updates, YooAsset first checks if it exists in the built-in resource directory, and then checks if it exists in the sandbox directory. If it does not exist in both places, it is considered to need to be downloaded.
Note: The sandbox directory in the editor is located in the game project and is at the same level as the Library folder.
Question: Unity 2021 editor shows "YooAssets is initialized!" when running the game
Try disabling: Project Setting ---> Editor ---> Enter Play Mode Options
Question: Compilation error due to missing DLL reference for YooAsset
- Please modify the API Level to .NET 4.x or .NET Framework in PlayerSettings.
- After closing the game project, delete all csproj files and sln files in the same directory as Assets.
- Delete the Library/ScriptAssemblies folder.
- Reopen the game project and then click on a script to recompile.
Question: Missing reference to UnityEditor.Build.Pipeline
YooAsset depends on ScriptBuildPipeline (SBP). You can find and install the SBP plugin in the PackageManager.
Question: After using FTP upload tools like FileZilla, file downloads always fail verification
Change the transfer type to binary.
Question: Error during packaging: Cannot mark assets and scenes in one AssetBundle. AssetBundle name is "assets_xxxx_scenes.bundle"
The Unity engine does not allow scene files to be packaged together with other asset files.
Question: Error on WebGL platform: Failed to decompress data for the AssetBundle.
WebGL platform does not support encrypted resource files. In the build options, you can set the encryption method to empty.
Question: Error on the actual device: The AssetBundle '__data' can't be loaded because another AssetBundle with the same files is already loaded.
This error usually occurs when there are multiple package resource bundles in the game. The solution is to check the Unique Bundle Name option in the AssetBundleCollector interface.
Question: YooAsset initialization takes 8 seconds every time it starts on some phones, but there is no issue on other phones.
Check if the sandbox content on the phone is stored in the SD card.
Question: Error in the space fighter DEMO: Exception: AndroidJavaException: java.lang.NoSuchMethodError: no non-static method with name='CheckAssetExist'
You can search for the relevant source code: StreamingAssetsHelper2.cs
This script is mainly used to automatically inject a piece of code when building the APK on the Android platform. The purpose of this code is to check whether a file is included in the StreamingAssets folder. If an error is prompted, it means that the injection has failed and you need to troubleshoot the cause yourself.
Question: Error at runtime: Failed to mapping location to asset path: xxxxxx
This error indicates that the mapping of the resource loading location to the asset path has failed. YooAsset supports 2 resource location modes.
If the Enable Addressable option is checked in the AssetBundle Collector window, it means that the addressable address entered during resource loading is invalid.
Note: Resource location addresses are case-sensitive!
package.LoadAssetAsync("scene_login");
If the addressable mode is not enabled, it means that the resource full path entered during resource loading is invalid.
package.LoadAssetAsync("Assets/Scenes/scene_login");
package.LoadAssetAsync("Assets/Scenes/scene_login.unity");
Question: Error at runtime: WaitForAsyncComplete failed! Try load bundle: xxxxxx from remote with sync load method!
This error indicates that the developer is using a synchronous method to load a resource that does not exist locally (the resource needs to be updated and downloaded).
There are 2 solutions:
- Change the loading method to asynchronous.
- Download all related resources to the local before loading.
Question: Does YooAsset support Unity 2018?
YooAsset consists of two parts: editor code and runtime code. Because the tool interface is written using UIElements, the visual tools cannot be used in versions before Unity 2019. However, this does not affect the use of YooAsset. Here is a solution.
Please install the Scriptable Build Pipeline plugin via Package Manager.
- Alternative solution for resource package collection tool
// 推荐直接手动编辑资源收集配置文件,在Sample工程里可以找到AssetBundleCollectorConfig.xml的文件,我们直接拿过来做模板。
// 然后通过以下代码来导入配置文件,成功之后AssetBundleCollectorSetting.asset文件会被刷新,就可以运行游戏了。
// 注意:每次修改完XML文件,都需要导入配置文件。
AssetBundleCollectorConfig.ImportXmlConfig("C://Demo//Assets//AssetBundleCollectorConfig.xml");
```
2. Alternative solution for resource package build tool
```
// You can directly refer to the tutorial documentation for resource package build. At the bottom of the document, there is an introduction to Jenkins support.
```
3. Alternative solution for resource package report tool
```
// We can create a project with YooAsset using Unity 2019 or higher to view the build report.
```
4. Alternative solution for resource package debugging tool
```
// YooAsset supports remote debugging on actual devices. We can create a project with YooAsset using Unity 2019 or higher for debugging.
// If you want to debug in the editor, you can create a debug interface similar to it.
```