CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
Troubleshooting
This section describes how to handle the errors and other issues that may occur when the CRIWARE Unity Plugin is used.
[Unity]
[ADX]
[Sofdec]
[FileMajik PRO]
[Android]
[iOS]

When a package is imported again, a "Move file failed" error occurs.

[Overview]

When the CRIWARE Unity Plugin package is imported again in Unity Editor, an error such as "Move file failed" occurs, and the import fails.

[Solution]

When the package is imported again while a scene is being loaded, an error may occur when some files are overwritten. Close the project, then import the package again (when a scene is not being loaded).

Page TOP


After the CRIWARE Unity Plugin Ver. 2.5x package is imported, an "undefined reference" error occurs.

[Overview]

In Unity Editor, after the CRIWARE Unity Plugin Ver. 2.5x package is imported, an error occurs saying that the CriManaPlugin does not contain a definition for criManaUnityPlayer_UpdateTextureByID.

[Solution]

When you upgrade from CRIWARE Unity Plugin Ver. 2.0x to Ver. 2.5x, obsolete files in your Unity project may cause problems.
Before importing the Unity package Ver. 2.5x, be sure to delete the following files and folders:
  • Plugins/CriWare/CriMana/Details/CriManaPlayerImpl.cs
  • Plugins/CriWare/CriMana/Details
  • Plugins/CriWare/CriMana/Shaders/DesktopAdditive.shader
  • Plugins/CriWare/CriMana/Shaders/DesktopAlpha.shader
  • Plugins/CriWare/CriMana/Shaders/DesktopAlphaAdditive.shader
  • Plugins/CriWare/CriMana/Shaders/DesktopRGB.shader
  • Plugins/CriWare/CriMana/Shaders/GLES20Additive.shader
  • Plugins/CriWare/CriMana/Shaders/GLES20Alpha.shader
  • Plugins/CriWare/CriMana/Shaders/GLES20AlphaAdditive.shader
  • Plugins/CriWare/CriMana/Shaders/GLES20RGB.shader
  • Resources/CriWare/CriMana/DesktopShaderHolder/Additive.prefab
  • Resources/CriWare/CriMana/DesktopShaderHolder/Alpha.prefab
  • Resources/CriWare/CriMana/DesktopShaderHolder/AlphaAdditive.prefab
  • Resources/CriWare/CriMana/DesktopShaderHolder/RGB.prefab
  • Resources/CriWare/CriMana/MobileShaderHolder/Additive.prefab
  • Resources/CriWare/CriMana/MobileShaderHolder/Alpha.prefab
  • Resources/CriWare/CriMana/MobileShaderHolder/AlphaAdditive.prefab
  • Resources/CriWare/CriMana/MobileShaderHolder/RGB.prefab
  • Resources/CriWare/CriMana
  • Resources/CriWare

Page TOP


Compilation error while updating the Unity plug-in package

[Overview]

If a copy of the plug-in is present in the Unity project when importing a new plug-in package (.unitypackage),
The following compilation error will occur:
The type or namespace 'XXXXX' could not be found (are you missing a using directive or an assembly reference?)

[Solution]

Starting from CRIWARE Unity SDK v3.03.00 (plug-in version v2.35.32), Assembly Definition
and namespace support has been added.
https://criware.info/criware-unity-plug-in-3-03-00/
Consequently, when importing an Assembly Definition-enabled plug-in into a project which includes an older version,
compilation errors may occur due to inconsistency in the namespaces and corrupted references.

Please follow the instructions in Plugin Package Migration Guide to switch to the new Assembly Definition-enabled plug-in.
Page TOP

ADX/Sofdec files in AssetBundle of Unity cannot be played directly

[Overview]

I want to play sounds and movies from ADX/Sofdec files in AssetBundle of Unity directly, but I do not know how to do it.

[Solution]

  • Please use Unity's Addressable Asset System along with the Asset Support add-on.
    Asset data created by CRI Assets can be loaded by the Addressable Asset System via the CRI Addressables feature.
    This allows streaming without copying the data into memory at loading time, even if it is contained in an AssetBundle.
  • It is the only solution to stream audio and video directly from AssetBundles that contain ACB files and CPK files.
    Otherwise, it is necessary to download and use non-asset CRI data directly instead of using data from AssetBundles.

Page TOP


An error occurs when a script is updated during scene playback on Unity Editor

[Overview]

On Unity Editor, a CRI error or a NullReferenceException error may occur when a script (in the application or in the plugin) is edited during playback (Playmode).

[Solution]

Currently, update of a script during scene playback (hot reload) is not supported.

When a script is edited while the application is running, all the scripts including the edited one will be recompiled. As a result, the static variables in the plugin are reset to the default status, leading to improper behavior.

You must not edit a script directly during playback (Playmode) on Unity Editor.
If you edited a script and stopped running the editor, abnormal termination may have occurred in the plugin.
Therefore, it is recommended that you restart Unity Editor when an exception occurred.

Page TOP


When a DllNotFoundException occurs on Linux

[Overview]

When running the Unity Editor or a pre-built server application on Linux,
a DllNotFoundException may occur, preventing you to use the plugin features.

[Solution]

To use the CRIWARE library for Linux, the PulseAudio driver must be installed.
Please check whether the PulseAudio driver is installed.

If your application is used as a server but does not require any audio/video playback,
you can simply add CRIWARE_ENABLE_HEADLESS_MODE in the Script Defined Symbols to avoid the issue.

  • When CRIWARE_ENABLE_HEADLESS_MODE is enabled, all calls to the DLL will be skipped.
  • Beware that some of the CRIWARE functions (e.g., status retrieving functions) will always return invalid values.

Page TOP


When I develop an application for iOS/Android, I do not understand the build target settings in CRI Atom Craft and how to embed data in Unity.

[Overview]

When I develop an application for iOS/Android, I find multiple build target settings in CRI Atom Craft. I do not know whether I need to output sound data from each of them and embed it.

[Solution]

You need not output sound data separately for iPhone and for Android.

For example, when an application is in the early stage of development, it is recommended that you embed one sound data output in iPhone into Unity and use it for PC, Mac, iOS, and Android.

After that, if you want to provide different encoding qualities between iPhone and Android as the development advances, output different sound data.

Page TOP


HCA-MX audio playback does not work properly

[Overview]

HCA-MX audio playback fails.

[Solution]

Please check the following points:
  1. Please reset the CRIWARE Library Initializer . Especially the settings for the HCA-MX Voice Pool Config of Atom Config. Basically, the aim is to increase the number of Voice Pools available for playback.
  2. Please reset the CRIWARE Library Initializer . Especially the settings for the Sampling Rate of Atom Config. When using HCA-MX encoded data, the same sampling rate must be used for all the sounds.
  3. For Android, please check if Low-latency sound playback on Android is used. The low latency playback function is not supported for HCA-MX data.

Page TOP


Sofdec.Prime fails in high-resolution movie encoding

[Overview]

Encoding of a high-resolution (4K) movie may fail.

[Solution]

Encoding of a high-resolution (4K) movie may fail because of the internal engine of Sofdec.Prime.

For details and the workaround, see "Tips > Encoding high-resolution movie data" section in "Sofdec Tools" User Manual (/CRIWARE/Tools/Sofdec2/CRI_Sofdec2_Tools_Manual_e.chm) provided with the SDK.

Page TOP


The installation feature of FileMajik PRO fails in downloading

[Overview]

The installation feature of FileMajik PRO cannot download files from the server.

[Solution]

If the installation feature of FileMajik PRO cannot download files from the server, check the following:
  • < Check whether the installation directory exists > Installation fails if the installation path contains a directory that does not exist. Before you can install files in a directory that does not exist, you must create it.
  • < Configure the server where files are located >
    • Check whether the server cannot recognize files because insufficient MIME types are configured.
    • Check whether specific extensions are allowed to be downloaded. (Are "cpk", "acb", "awb", and "acf" extensions allowed to be ?)
    • Check whether the server error log contains a message about installation failure.
  • < Confirm the file path > Are target files located properly on the server?

Page TOP


The files downloaded by the install feature of FileMajik PRO are corrupted

[Overview]

The files downloaded from the server by the install feature of FileMajik PRO are corrupted.

[Solution]

If the files downloaded from the server by the install feature of FileMajik PRO are corrupted, check whether the Range header setting is enabled on the server.

The install feature of FileMajik PRO transfers data from the server with the HTTP/1.1 protocol. It adds a Range header to a GET request to download data.
Therefore, if the Range header is disabled on the server, data cannot be downloaded properly. Data after a few MB from the beginning will be corrupted.

[Note]
Due to corrupted data, the data after the size specified at "Install Buffer Size" in the "Initialize FileSystem" group setting of the CriWareInitializer component may be invalid.
For example, if the "Install Buffer Size" setting is 4 MB, the data after 4 MB from the beginning is invalid. It was reported in the past that a server wrote the 4 MB data from the beginning repeatedly.

Page TOP


File installation does not end

[Overview]

Installation of files over the network by the CriWare.CriFsInstaller class does not end.

[Solution]

Set CriWare.CriFsWebInstaller.ModuleConfig.inactiveTimeoutSec to the appropriate value in the initialization configuration structure of CriWare.CriFsWebInstaller.
If the installation is somehow delayed, errors will be logged when the time-out occurs.

Page TOP

ADX sound is played when an Android device is in the silent mode

[Overview]

ADX sound is played when an Android device is in the silent mode

[Solution]

The CRI Atom library cannot detect the silent mode and mute
playback. Therefore, the application must detect the silent mode and mute playback.

You can use the following methods to mute playback in the Atom library.
  1. Set the volumes of all AtomExPlayers to zero.
    (Note: This takes effect only in the app. The volumes of all AtomExPlayers must be controlled. Note that the Atom library does not provide a batch mute feature.)
  2. Set the media volume to zero in Android.
    Use android.media.AudioManager in the Android API to set the media volume (AudioManager.STREAM_MUSIC) to zero.
    (Note: This takes effect also on the media volume other than the target app.)

Page TOP


ADX/Sofdec data cannot be played from .OBB files created with the "Split Application Binary" option

[Overview]

ADX/Sofdec data cannot be played from .OBB files created with the "Split Application Binary" option. Export the target file from the .OBB file as a separate file on the application side, and play it.

[Solution]

With the "Split Application Binary" option on Unity Editor, you can divide the content under StreamingAssets into split application binary (.OBB) files. However, the CriWare plugin cannot play ADX/Sofdec data directly from an .OBB file.
Split Application Binary
Split Application Binary is a feature of Unity Editor. This option divides an .apk file into extended files (.apk + .obb). For details, see Unity official documentation.
When this option is enabled on Unity Editor, all data in StreamingAssets are archived in different zipped files named *.main.obb.
The CriWare plugin cannot play ADX/Sofdec data directly from the zip files.
How to play ADX/Sofdec data in an .obb file
To handle data with "Split Application Binary", write the ADX/Sofdec data in a the .obb file into a single file.
To write data from the .obb, you can use the WWW class in UnityEngine. Then, play the resulting file with the CriWare plugin. Below is an example to write such a file:
using System.Collections;
using System.IO;
/* Class to write files from srcPath to dstPath */
public class FileExtracter : MonoBehaviour {
/* The USM file name allocated under StreamingAssets of the Unity project.
* If Split Application Binary is enabled, the files under StreamingAssets will be packed into the .obb files */
private string srcFile = "criware_movie.usm";
/* The output destination in this sample is the SD card. Please change it to the appropriate destination for your development environment if necessary.
* You will also need to set Write Access to External in the Android PlayerSettings of Unity */
private string dstPath = "/storage/emulated/0/dst.usm";
IEnumerator Start() {
/* If an.obb file is found, Application.streamingAssetsPath will point to the obb */
string srcPath = Path.Combine(Application.streamingAssetsPath, srcFile);
/* Use the WWW class to load the contents of srcPath */
WWW www = new WWW(srcPath);
Debug.Log("Copy " + srcPath + " to " + dstPath + " is started.");
yield return www;
/* Write the loaded byte array (www.byte) to dstPath */
System.IO.FileStream fileStream = new System.IO.FileStream(dstPath, System.IO.FileMode.Create, System.IO.FileAccess.Write);
fileStream.Write(www.bytes, 0, www.bytes.Length);
fileStream.Close();
Debug.Log("Complete");
}
}
Attention
The playback method described above is only provided as an example. Note that the specific implementation has not been verified.

Page TOP


On Android, the background application does not stop its sounds.

[Overview]

On iOS, the background application stops playing its sounds, but not on Android.

[Solution]

This may occur when the CriWare.CriWareInitializer component is mistakenly destroyed.

Check that the CriWare.CriWareInitializer::dontDestroyOnLoad property is configured properly.
If the property is set to false, the CriWare.CriWareInitializer is automatically destroyed when a scene is finished.

If the sound playback continues after the CriWare.CriWareInitializer component is destroyed, the stopping and resuming of the application is not detected, which can cause this issue.
To play sounds across scenes, set the above property to true.

Page TOP


Unable to access the data files of CRIWARE with Play Asset Delivery

[Overview]

When using the built-in Play Asset Delivery feature in Unity in order to include the audio or video data files of CRIWARE in an "Asset Pack", it may not be possible to access files with a relative path from the normal StreamingAssets, depending on the current settings.

[Solution]

The actual storage location of the AssetPack varies depending on the delivery mode (i.e., install-time, fast-follow, and on-demand) or the AssetPack type (i.e., default or custom asset pack).
As the file loading function of CRIWARE needs to pass an actual file path, make sure to get the correct path according to these settings.

When using a custom asset pack, a file path can be obtained as follows, regardless of the delivery mode or pack type:
// when AndroidAssetPacks.coreUnityAssetPacksDownloaded == true
string assetPackPath = AndroidAssetPacks.GetAssetPackPath("<custom asset pack name>");
string criDataPath = System.IO.Path.Combine(assetPackPath, "<relative path of files under asset pack>");
We recommend the use of custom asset packs as the common access method.

However, if you use the default settings of Unity to create the asset packs, note the following:
The contents of StreamingAssets may be included in a single AssetPack (i.e., fast-follow asset pack), depending on the sizes and the total capacity for the additional assets.
In this case, you can get the asset pack path by passing "UnityStreamingAssetsPack" for the name to the GetAssetPackPath function above.
Otherwise, the behavior is the same than when Play Asset Delivery is not used, and the data can be accessed by passing the relative path from StreamingAssets to the CRIWARE function.
Note that if the data size conditions change, the method to access the StreamingAssets folder will also change.

For more information about Play Asset Delivery, such as the conditions for automatic creation of asset packs, please refer to the Unity manual and the official Android developer website.

Page TOP


Audio and movie playback do not proceed after launching the iOS app

[Overview]

After launching the application, there may be a problem where the sound will not be played by ADX and the movie playback by Sofdec will not proceed.
This is likely to occur if a system dialog such as "Allow notifications" is displayed when the application is launched for the first time after installation.
After this issue occurs, if suspend or resume operations is performed, playback will be started again.

[Solution]

Be sure to initialize the plugin after the system dialog mentioned above appears.
Detailed measures are as follows.
  • Place an empty scene that displays only the splash screen as the startup scene
  • Initialize after the transition from the above scene to the normal startup scene has finished.

In iOS 8.0 or later, ADX sound may not be played

[Overview]

In iOS 8.0 or later, when API AudioSettings.OutputSampringRate is set in Unity, the following problems may occur.
  • No ADX sound is played. However, sound processing is performed.
  • after suspend and resume, ADX sound is played.

[Solution]

When ADX is used, to avoid the problem, do not set AudioSettings.OutputSampringRate.

Page TOP