docs.unity3d.com
  • Manual
  • Scripting API
  • Changelog
  • License

    • Unity Live Systems Data
      • Installation
      • What's new
      • Upgrade guide
    • Get started
      • Take it further
    • Basic concepts
    • Configure your service
      • Add and configure user-supplied secrets
      • Associate 3D objects with source devices
      • Configure a facility device simulator
      • Configure data connectors
        • Device connectors
          • Azure IoT Hub device connector
          • Facility Simulator device connector
          • HTTP device connector
        • Telemetry connectors
          • Azure EventHub telemetry connector
    • Develop your application
      • Create environment settings
      • Create a services controller
      • Implement a telemetry history controller
    • Troubleshooting
    • Glossary
    • REST APIs

    Get started

    To help you get started with Live Systems Data SDK package, this page provides steps to set up a sample end-to-end project. This page isn't a tutorial, but instead helps you set up required settings you can later use to build more complex projects.

    This sample project implements a basic scenario in which a single simulated device produces telemetry data, which is processed by Live Systems Data services and delivered to a client that’s built in Unity. The facility simulator instance that generates the telemetry data is already configured and hosted in the Live Systems Data services. The client that you configure in this sample project uses the Live Systems Data SDK package to consume the telemetry data, but has no 3D models associated or visualization. During Play mode, the Unity Editor’s Inspector window displays setting values that confirm whether you successfully completed a step.

    Note: Though the Telemetry history service is in the sample, it's not currently supported or configured in this page.

    This page includes resources, which you can access either during or after a step, with additional information about the systems related to each component.

    To successfully set up this sample, follow these sections in order:

    1. Overview
    2. Prerequisites
    3. Install the Live Systems Data SDK sample
    4. Open the project
    5. Open the Environment settings
    6. Run the project
    7. Main components
    8. Troubleshooting

    Overview

    The sample project in this page implements the following components found in a typical Live Systems Data client solution:

    • Environment settings: A collection of addresses and IDs used to connect the Live Systems Data client to an external data source.
    • Login controller: Handles connection and behavior for the Unity Cloud Identity package, which includes retrieving user information and access tokens.
    • Configuration service: Retrieves configurable data, which includes device summaries and time series plots.
    • Device service: Retrieves a list of DeviceResource objects and converts it to a list of LiveDevice objects. The LiveDevice list is returned as a whole or you can request individual LiveDevice objects by their ID.
    • Notification service: Receives notifications from the Live Client.
    • Facility service: Retrieves facility information from the Live Client.

    Note: Although this page refers to the different components as services, they're client-side configurations for the corresponding component in the Live Systems Data services platform.

    It should take you less than one hour to go through this page, after which you'll have a project that runs end-to-end and teaches you about the Live Systems Data SDK package.

    Prerequisites

    Before you get started, make sure you have the following:

    • A Unity project with installed Live Systems Data SDK packages
    • A valid Unity ID
    • A valid Unity Industrial Collection (UIC) license

      Tip: For more information about using the UIC license, refer to the UIC onboarding guide.

    • An application identifier
    • A Unity Cloud scene associated with your Unity ID

    Install the Live Systems Data SDK sample

    To install the How To Use Services sample, follow these steps:

    1. In the Unity Editor, go to Window > Package Manager > Packages: In Project > Digital Twins Live SDK.
    2. Expand the Samples section and select Import next to How To Use Services.

      Screenshot of the How To Use Services sample in the Package Manager

    Result:

    • The sample loads and compiles in the Unity Editor. No errors should appear in the Console window.
    • You can find the imported How To Use Services sample in your Assets/Samples/Digital Twins Live SDK/<package-version> directory.

      Screenshot of the How To Use Services sample in the directory

    Open the project

    In the Main components section, you use the sample service in the project.

    Note: Though the Telemetry history service is in the sample, it's not currently supported or configured in this page.

    To open the project, follow these steps:

    1. In the Project window, go to the Assets/Samples/Digital Twins Live SDK/<package-version>/How To Use Services/HowToUseServices.unity file to open the How To Use Services sample.
    2. Confirm that you have the following GameObjects in your Hierarchy window:

      • Services
        • Login
        • Configuration
        • Device
        • Notification
        • Facility
      • DeviceGameObject

      Screenshot of the How To Use Services hierarchy

    Each GameObject provides access to a specific aspect of the configuration and lets you validate whether the corresponding service is working correctly.

    Open the Environment settings

    To open and edit the EnvironmentSettings script, follow these steps:

    1. In the Project window, go to the Assets/Samples/Digital Twins Live SDK/<package-version>/How To Use Services/Settings folder.
    2. Select EnvironmentSettings to change its values in the Inspector window.
    3. Select the Services GameObject in the Hierarchy window.

    Result: The Inspector window displays the ServicesController for your GameObject, which has links to default objects for your Environment Settings.

    Run the project

    Most of the main components require access to the Inspector window in the Unity Editor, so use this sample project only in Play mode.

    To run the project in Play mode, follow these steps:

    1. Select Play in your Unity project.
    2. Make sure that the scene is running and that you have successfully logged in. Keep the project in Play mode while you use the Main components.

    Result:

    • A browser window launches that prompts you to log in with your Unity ID account. After you successfully login, you're requested to return to the running project and you can dismiss the prompt.
    • The Game view display includes the No cameras rendering message, but is otherwise blank because there are no cameras in the project.

      Screenshot of the No cameras rendering message

    Main components

    The sample project is configured to connect to the Live Systems Data service and consume the telemetry that the Facilities Simulator instance produces. This section outlines where to set these configurations in the project and how to confirm that they’re working correctly.

    Though this page isn't a coding tutorial, you can find more information about the scripts and sample code in Take it further.

    Login controller

    Once the project is running, the login controller holds the access token that authenticates the user with the Live System Data services.

    To check the login controller information, go to HowToUseServices > Services > Login in the Hierarchy window.

    Result: The Inspector window displays the access token information associated with the current login session (refer to the following screenshot).

    Screenshot of the login controller information

    Note: To access the LoginController script, go to the Assets/Samples/Digital Twins Live SDK/<package-version>/How To Use Services/Controllers folder.

    Configuration service

    To use the configuration service, follow these steps:

    1. Go to HowToUseServices > Services > Configuration in the Hierarchy window.
    2. Select Use Service in the Inspector window. If your Device Type and Telemetry Key have valid parameters, your Result field is populated.

    Result: The Result field displays the retrieved Device Summary Results and the Time Series Plot Message. You might need to expand the Result field to check the list of results (refer to the following screenshot).

    Screenshot of the configuration service result information

    Note: To access the ConfigurationController script, go to the Assets/Samples/Digital Twins Live SDK/<package-version>/How To Use Services/Controllers folder.

    Device service

    To use the device service, follow these steps:

    1. Go to HowToUseServices > Services > Device in the Hierarchy window.
    2. Select Use Service in the Inspector window.

    Result:

    • The Result field displays the retrieved Live Devices and the Selected Live Devices. You might need to expand the Result field to check the list of results (refer to the following screenshot).

      Screenshot of the device service result information

    • The first LiveDevice you retrieve is associated with a GameObject in the scene that represents the device's 3D model, which you can access by expanding the first Live Device entry in the Result field (refer to the following screenshot for an example).

      Screenshot of the live device's game objects

    Note: To access the DeviceController script, go to the Assets/Samples/Digital Twins Live SDK/<package-version>/How To Use Services/Controllers folder.

    Notification service

    To use the notification service, follow these steps:

    1. Go to HowToUseServices > Services > Notification in the Hierarchy window.
    2. Select Use Service in the Inspector window.

    Result:

    • The Result field displays the complete NotificationServiceResult. You might need to expand the Result field to check the list of results (refer to the following screenshot).

      Screenshot of the notification service result information

    • The Facility Simulator constantly generates notifications for this sample project. If you select Use Service multiple times, more events load and appear in the list (refer to the following screenshot for an example). The results aren't ordered based on any specific criteria. Use the handle (=) to sort the Latest Notifications.

      Screenshot of multiple result notifications

    Note: To access the NotificationController script, go to the Assets/Samples/Digital Twins Live SDK/<package-version>/How To Use Services/Controllers folder.

    Facility service

    To use the facility service, follow these steps:

    1. Go to HowToUseServices > Services > Facility in the Hierarchy window.
    2. Select Use Service in the Inspector window.

    Result: The Result field displays the complete FacilityServiceResult. You might need to expand the Result field to check the list of results (refer to the following screenshot).

    Screenshot of the facility service result information

    Note: To access the FacilityController script, go to the Assets/Samples/Digital Twins Live SDK/<package-version>/How To Use Services/Controllers folder.

    Troubleshooting

    Nothing is rendering in the scene

    This sample scene doesn't have cameras or UI. Instead, the sample displays visual confirmation of the services through the following:

    • Log outputs to the console
    • Public fields in the Inspector window when you select GameObjects in the Hierarchy window that have different Controller components
    Back to top Generated by DocFX
    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