docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Sample: Stream and Move Multiple Models

    You can use this sample to stream multiple models from the Unity Editor project StreamingAssets directory. You can choose which models to view, move the camera around the models, and move the models in the scene.

    Important

    This sample is designed to work on PC. It may not behave as expected on other platforms, such as iOS or Android.

    Before you start

    Before you use the Data Streaming multi-model sample, you must have the following:

    • Installed Data Streaming package and its dependencies
    Important

    This sample is designed to work on PC and may not behave as expected on other platforms like iOS and Android.

    Install the sample

    To install the sample, follow these steps:

    1. In your Unity project, go to Window > Package Manager > Unity Cloud Data Streaming.
    2. Expand the Samples section.
    3. On the right of the Multi-Model sample, select Import.
    4. When requested to import the sample files into the StreamingAssets folder, click Yes.

    After the import process completes, you can view the imported assets under the Assets/Samples/Unity Cloud Data Streaming and Assets/StreamingAssets/MultiModel folders.

    Run the sample

    To run the sample, follow these steps:

    1. In your Unity Editor project, go to File > Open Scene.
    2. Go to Assets/Samples/Unity Cloud Data Streaming/<package-version>/Multi-Model Sample/Scenes/MultiModelSample.unity.
    3. Run the scene.
    4. To stream a model, toggle some of the checkboxes.
    5. To move the stage, select the StageTransform game object in the Hierarchy window and change the values of the Transform component.
    6. To move a specific model, select its game object under StageTransform in Hierarchy window and change the values of the Transform component.

    Main components

    This section describes the scripts that make up the multi-model sample.

    MultiModelSample script

    The MultiModelSample class connects the 3 scripts together. It first launches the IDataStreamer, add the available model paths to the UI, and add or remove models from the streamer based on the state of the UI toggles.

    To use a custom dataset, put your json and glb files inside Assets/StreamingAssets, select the MultiModelSample game object, and add the path to the collection of paths in the inspector.

    The MultiModelSample component in the inspector with an additional path for a custom model

    TransformController script

    The TransformController class receives all displayed models and associates each of them with a game object and a transform in the scene hierarchy under the StageTransform game object. It then synchronizes the values of these tranforms with the transforms applied to the models that are currently on the stage.

    UIView script

    The UIView class displays the checkboxes for the models onto the Canvas and fires an event every time a toggle is toggled by the user.

    Troubleshooting

    Refer to the troubleshooting section for help with the sample.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)