CRIWARE Unity Plugin Manual  Last Updated: 2025-05-08
Background playback

Sample contents

Overview

This is a sample that controls background audio playback from a script. (iOS/Android only)

cri4u_samples_criatom_script09_main.png

How to use

"bgm_04" will automatically start playing when the scene starts.
Playback can be started with the [Play] button and stopped with the [Stop] button.
Pressing the [<< Prev] button will stop the Cue currently playing and play the previous Cue (in the order of the data on the Cue sheet).
Press the [Next >>] button to play the next Cue.
Audio playback will continue even if the sample app is suspended.

Scene Information


Middleware CRI ADX (CRI Atom)
Sample Script sample: Background playback
Location /CRIWARE/SDK/unity/samples/UnityProject/Assets/Scenes/criatom/script/ScriptSample09_SeamlessSequencePlayback/Scenes
Scene File ScriptSample09_BackgroundPlayback.unity
Original ADX data None


Program explanation

This is a sample that enables background audio playback from a script.
You can turn the background playback function on and off via platform-specific functions or properties.
Please note that the setting methods for iOS and Android are different.
The music to be played is specified in the sample script and will be played automatically when the script starts to run.
The GUI for switching the audio content to be played is also implemented in the script's OnGUI function.

About the background audio playback script

Turn background playback on and off in platform-specific ways:

On platforms other than the one supported by the setting method, the setting will not function or affect the program.

In the sample, the functions are enabled and disabled in Start() and OnDestroy(), respectively.
Background playback works between the two function calls.