docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Sample: Stream a Unity Cloud Asset in a Unity Project

    You can use the Cloud Sample to stream an asset from the Unity Cloud. You can choose which asset to view and move the camera around to see how data streaming will only stream the parts which are relevant to the camera's current perspective.

    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 Cloud Sample, you must have the following:

    • Installed Data Streaming package and its dependencies
    • Installed Identity package
    • Installed Assets package
    • A valid Unity ID
    Note

    The additional dependencies aren't required to use the base package.

    Upload an asset

    If not already done, upload an asset to the Asset Manager:

    1. Log into the Asset Manager Dashboard.

    2. Select Add asset to create a new asset.

      Screen capture that displays adding a new asset

    3. Name the asset My First Asset, drag and drop the files to upload, and execute the 3D Data Streaming workflow.

      Screen capture that displays uploading files for your asset

    4. Select Publish asset to finalize.

      Screen capture that displays publishing your asset

    Note

    Depending on the size of the file, it may take some time to run the workflow. When the workflow completes, the asset contains more files than previously uploaded.

    Install the sample

    To install the sample, follow these steps:

    1. In your Unity Editor Project, go to Window > Package Manager > Unity Cloud Data Streaming.

    2. Expand the Samples section.

    3. On the right of the Cloud sample, select Import. Screenshot of the Package Manager's Data Streaming samples

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

    Run the sample

    Note

    Before you run the samples, you need the additional dependencies installed. See the Before you start section for more information.

    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>/Cloud Sample/Scenes/CloudSample.unity and run the scene.

    3. In the Game view, select Login if you are logged out.

      Note: If you've previously logged in, the sample automatically logs you in so you can proceed to step 6.

    4. Log into the browser window that launches with your Unity ID account.

    5. Return to the sample scene to confirm that you are logged in. The Workspace field lists the workspaces associated with your account.

    6. From the Organization field, select an organization.

    7. From the Project field, select a project.

    8. From the Asset field, select an asset.

    9. Select Launch to download and view the associated dataset.

      Screenshot of a selected Workspace and Scene with Launch Scene enabled

    10. Instructions on how to navigate the scene are on the screen. Screenshot of a launched demo scene with instructions

    Main components

    This section describes the scripts that make up the Cloud Sample.

    Cloud Sample script

    The CloudSample class demonstrates how the DataStreamer is used to load an asset from the Asset Manager. The selected dataset is provided as an IAsset parameter. The IAsset parameter passes to the DataStreamer, which loads and displays the associated dataset.

    To open the Cloud Sample script, go to the Assets/Samples/Unity Cloud Data Streaming/<package-version>/Cloud Sample/Scripts/CloudSample.cs file.

    Platform services script

    The PlatformServices class initializes and disposes of the Data Streaming service's dependencies and other dependencies that the sample requires. The PlatformServices class exposes these services so that any component of the sample that requires access to a Unity Cloud service has easy access.

    The PlatformServices class has two accompanying classes called PlatformServicesInitialization and PlatformServicesShutdown that call the initialization and shutdown methods through Unity's standard Monobehaviour methods Awake(), Start() and OnDestroy().

    To open the platform services script, go to the Assets/Samples/Unity Cloud Data Streaming/<package-version>/Shared/Scripts/Services/PlatformServices.cs file.

    Login manager script

    The LoginManager class is responsible for the user login and scene selection. Refer to the Identity package and Assets package documentation and samples for information about user authentication and model information.

    To open the login manager script, go to the Assets/Samples/Unity Cloud Data Streaming/<package-version>/Shared/Scripts/Login/LoginManager.cs file.

    Troubleshooting

    Refer to the troubleshooting section for help with the Cloud Sample.

    In This Article
    Back to top
    Copyright © 2024 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)