docs.unity3d.com
    Show / Hide Table of Contents

    Sample | Workspaces and Scenes

    You can use the Workspaces and Scenes sample to retrieve the Unity Cloud workspaces and scenes that a user can access. You can view the workspaces associated with your Unity ID and information about these workspaces, along with the scenes for those workspaces.

    Prerequisites

    To use the Workspaces and Scenes sample, you require the following:

    • An installed Storage package
    • An installed Identity package
    • A valid Unity ID
    • A number of Unity Cloud workspaces and scenes associated to your Unity ID

    Note: While the Storage package doesn't depend on the Identity package, the Identity package is used in the sample to control the authentication flow.

    Installation

    To install the sample, follow these steps:

    1. In your Unity project, go to Window > Package Manager > Unity Cloud Storage.
    2. Expand Samples and select Import beside the Workspaces and Scenes sample. Screenshot of the Package Manager's Workspaces and Scenes samples

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

    Run the sample

    To run the sample, follow these steps:

    1. In your Unity project, go to File > Open Scene.
    2. Go to Assets/Samples/Unity Cloud Storage/<package-version>/Workspaces and Scenes/Scenes/WorkspacesAndScenes.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 Workspaces section lists the workspaces associated with your account.
    6. Select a workspace from the Workspaces section to see information about that workspace. Screenshot of the Workspaces and Workspace Info sections
    7. Select a scene from the Scenes section to see information about that scene. Screenshot of the Scenes and Scene Info sections

    Main components

    This section describes the scripts that make up the Workspaces and Scenes sample.

    Workspaces and scenes sample script

    This sample contains various components (hidden under the UI folder), whose purpose is to manage a complex and advanced UI, such as WorkspacesReadOnlyBehaviour or ScenesBehaviour.

    When using the Storage SDK, the most important classes to be familiar with are the following:

    • WorkspacesReadOnlyController shows how to use IWorkspaceRepository and gets a list of IWorkspace.
    • WorkspaceViewer shows how to extract information from an IWorkspace
    • ScenesController shows how to use IWorkspace and gets a list of IScene.
    • SceneViewer shows how to extract information from an IScene.

    Platform services script

    The PlatformServices class initializes and disposes of the IWorkspaceRepository and its dependencies. The PlatformServices class exposes the provider through a property so any component that needs to retrieve workspace information can use this provider.

    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().

    Login manager script

    The LoginManager class is responsible for the user login. Refer to the Identity package and its samples for details about user authentication.

    Troubleshooting

    This section describes issues you might have while using the Workspaces and Scenes sample.

    I have a missing dependency error message for com.digital-twins.identity

    If you don't have the Identity package installed, you receive the following error in your console: error CS1029: #error: 'Missing dependency to com.unity.cloud.identity package.'

    Use the Package Manager to add the Identity package to your project.

    I can't view any workspaces or scenes

    Make sure you have successfully created at least one Unity Cloud scene through the Unity Cloud Asset Manager on the Unity Cloud Portal.

    The automatic browser redirection doesn't work

    If you run the sample in the Unity Editor, you should see the following page after you successfully login through your browser.

    Screenshot of a successful login

    If you aren't automatically redirected to the Editor and nothing happens when you select Launch Application, return to the Editor. This should continue the authentication process.

    The mouse input isn't registered

    This sample isn't created to run with the Input System package. If you're using this package in your project, your mouse selections may not be detected.

    To fix this, set your project to support both the built-in input system and the Input System package: go to Edit > Project Settings > Player and set Active Input Handling to Both.

    Screenshot of the Active Input Handling field

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023