CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
Can start from any scene

Description of the sample

Overview

This sample can start from any scene in Unity Editor while controlling sounds across scenes.

cri4u_samples_criatom_script04_main.png

Operations

You can run this sample from "ScriptSample04_TitleScene" or "ScriptSample04_GameScene" in Unity Editor.
  • change scene button in the top-right corner of the screen
    Toggles between ScriptSample04_TitleScene and ScriptSample04_GameScene.

Scene information


Middleware CRI ADX (CRI Atom)
Sample Script sample: Can start from any scene
Location /CRIWARE/SDK/unity/samples/UnityProject/Assets/Scenes/criatom/script/ScriptSample04_OverSceneEverywhere
Scene files ScriptSample04_TitleScene.unity
ScriptSample04_GameScene.unity
Original ADX data Data: Simple cross-fading of music


Description of the program

This sample is the " Sound control across scenes " sample modified so that it can be started from any scene.
It is inconvenient to start a large game with many scenes on the title screen every time. Therefore, it is recommended that this mechanism should be used.
This program prefabricates the objects that will exist across scenes and add them to each scene.
Although prefabrication is not mandatory, it is useful, for example, when the options of the CRIWARE Library Initializer are changed, because the changes can be applied to all the scenes at once.

How to enable the start of the script from any scene

First, configure the CRIWARE Library Initializer, CRIWARE Error Handler, CRIWARE, and SoundManager so that they can exist across scenes, based on the steps in the " Sound control across scenes " sample.
The following procedure describes the steps to enable the script to stat from any scene, based on the " Sound control across scenes " sample.

(1) Select the ScriptSample04_TitleScene. In the Hierarchy window, drag and drop the CRIWARE Library Initializer, CRIWARE Error Handler, CRIWARE, and ScriptSample04_SoundManager into the Project window one by one. This completes the prefabrication.

cri4u_samples_criatom_script04_prefab.png

(2) Select GameScene.
(3) In the Project window, drag and drop the prefabricated CRIWARE Library Initializer, CRIWARE Error Handler, CRIWARE, and ScriptSample04_SoundManager into the Hierarchy window of the ScriptSample04_GameScene.

cri4u_samples_criatom_script04_hierarchy.png
Now you can run the script either from ScriptSample04_TitleScene or from ScriptSample04_GameScene.