Introduction to Digital Twins with Unity
Tutorial
·
intermediate
·
+10XP
·
30 mins
·
(245)
Unity Technologies

In this tutorial, you'll master the essentials of digital twins, from their foundational concepts to their real-world applications across industries. Then, you'll put theory into action by creating a simple digital twin in Unity, simulating a fire scenario to test emergency responses with AI-driven characters.
By the end of this tutorial, you’ll be able to do the following:
- Define the concept of digital twins and their relevance across various industries.
- Explain the significance and benefits of utilizing digital twins in different applications.
- Describe the high-level process of creating an example of a digital twin from start to finish.
- Create a simple simulation on a digital model to demonstrate the power of real-time 3D technology in the creation of digital twins.
Languages available:
1. Overview
In this tutorial, you will learn about digital twins and their applications across different industries. First, you’ll cover the basics of digital twins, including what they are, their benefits, real-world examples, and potential risks. Then, you’ll create a very simple digital twin yourself. You will import a CAD model of a building that has already been configured for compatibility with Unity, add a script to create NavMeshes for AI navigation, and place characters in a simulated fire scenario to test emergency response using Unity's AI.
2. What are digital twins?
A digital twin is a virtual model designed to accurately reflect a physical object, process, or system. This concept is widely used across various industries, including manufacturing, urban planning, healthcare, and more. A digital twin can be used to simulate, analyze, and predict the performance of their physical counterparts in the real world. By leveraging data from sensors, historical data, and other sources, digital twins enable real-time monitoring, diagnostics, and optimization of operations. Some use cases for digital twins include the following:
- Product configurators for marketing and sales

- Communicate design features in architectural projects

- Implemented in collaborative design systems

- Used for efficient facilities management

Digital twins use technologies such as internet of things (IoT), artificial intelligence (AI), machine learning, and big data analytics to create a dynamic and evolving model that can provide insights and help in decision-making processes.
3. The benefits of using digital twins
Digital twins allow you to integrate different technologies to form a digital representation of your projects, processes, or systems. This enables you to simulate or manage tasks that would otherwise be time-consuming or costly. Below are a few examples of applications for digital twins:
- Predictive maintenance: Anticipating equipment failures before they occur, thus reducing downtime and maintenance costs.
- Process optimization: Improving the efficiency of processes by simulating different scenarios and identifying the most effective strategies.
- Product development: Speeding up the design process by testing and refining prototypes in a virtual environment before creating physical versions.
- Performance monitoring: Continuously tracking the performance of systems or infrastructure to ensure they operate within optimal parameters.

4. Types of digital twins
Digital twins can be categorized into several types based on their complexity, purpose, and the aspect of the physical world they replicate. These categories are useful to help understand the scope and application of digital twins across different industries and functions. Here are some of the primary types of digital twins:
Level 1 - The virtual twin
The virtual twin is a precise digital replica of a physical asset or product, offering an interactive 3D model that accurately reflects its real counterpart.
Level 1 twins are the simplest type and are typically little more than a virtual model. An example of this is a 3D CAD/BIM model of a building. The advantage of using a level 1 model in this context is that you create an accurate representation that can be used as a reference or foundation for further levels.

Level 2 - connected twin
Level 2 twins are a slightly more aware version of a digital twin than level 1. By incorporating real-time data and IoT integration for immediate insights into asset performance, level 2 twins enable on-the-spot monitoring and reporting.
An example of this is the level 1 model that also shows the heat distribution and electricity usage of the house in real time.
The advantage of level 2 twins is that they allow users to monitor the operations of a system in real time.

Level 3 - predictive twin
Level 3 twins use analysis of the level 2 data to forecast outcomes and identify potential issues in complex facilities and equipment operations.
The advantage of level 3 twins is that they act as a decision-assist tool, enhancing predictive maintenance by analyzing trends to prevent problems before they occur.
An example of this is a system that forecasts the gas usage in a building for a given month, allowing the owner to budget appropriately.

Level 4 - prescriptive twin
Level 4 twins combine advanced modeling, real-time simulation, and machine learning for predictive scenarios, offering prescriptive analytics and intelligent recommendations.
Level 4 twins are more intelligent than level 3 twins since they have more contextual understanding of the situation. Just like level 3 twins, level 4 twins can make predictions based on data, but they can also suggest alternative models that may be more cost effective.
The advantage of a level 4 digital twin is that it is a smart system that can use simulations and analysis to provide better models to the user.

Level 5 - autonomous twin
Level 5 twins autonomously correct issues and enable predictive and prescriptive analytics using real-time data and artificial intelligence. Level 5 twins learn from multiple data feeds to make decisions, allowing for autonomous actions that improve operations without human intervention.
The advantage of level 5 twins is that they can take the analysis and options from level 4 twins and implement actions autonomously. Level 5 twins are self-optimizing systems that are not only smart, but can also make decisions based on the knowledge they have.
An example of this is autonomous vehicles that can use visual and sensor data to predict the actions of other vehicles and pedestrians.

5. Potential Risks of digital twins
Digital twins bring notable advantages, but they also introduce several risks and challenges:
- Initial costs: Digital twin technology can require significant investment, which may limit its adoption to larger organizations over smaller ones.

- Data quality: The effectiveness of digital twins relies on the accuracy and timeliness of data, with any integrity issues demanding strict data management.

- Integration: Smoothly integrating digital twins into existing systems requires complex and labor-intensive efforts for data and system compatibility.

- Technical expertise: Deploying digital twins necessitates specialized skills in data analytics and software development, along with the need to address scaling challenges.

- Security and privacy: The extensive and sensitive data managed by digital twins heightens the need for robust cybersecurity and privacy measures.

- Technology dependence: Dependence on digital twins introduces risks of vulnerabilities, which thus emphasizes the importance of backup plans and reducing reliance.

- Regulatory compliance: Ensuring digital twins comply with specific regulations and data laws is crucial to avoid potential legal issues.

These risks mean that in order to successfully use digital twins, you will need to carefully plan, regularly spend on tech and know-how, and stay ahead in managing data and security. Even with these challenges, using digital twins well can spark new ideas and bring big advantages.
6. Explore a sample of a digital twin
Let's check out at a digital twin example. In this instance, we've digitally recreated the Unity Brighton office.

Through a web interface, you can check maintenance systems, check out camera feeds, and get updates on any security events.
This is a basic example and doesn’t use real live data or security footage. In the real world, digital twins can connect with multiple systems to create an extensive and advanced real-time data stream that gives different roleplayers the information they need at the right time.
7. Skills required to develop digital twins
The specific skills required to develop digital twins depend on the complexity of the system you want to design. Below are some of the typical skills that are required on a project:
- 3D/CAD modeler: Digital twins that require 3D representations typically need very accurate 3D models. These are usually created in CAD software and require a competent CAD modeler.
- System modeling and simulation: Understanding how to create accurate models and simulations of physical systems, including knowledge of the mathematical and physical principles that govern those systems.
- Data analytics and science: Ability to analyze and interpret complex datasets, using predictive analytics and machine learning algorithms to understand patterns and predict outcomes.
- Software development: Proficiency in programming languages commonly used in digital twin development, such as C#, Python, C++, or Java, and experience with software development frameworks and practices.
- Internet of things (IoT): Knowledge of IoT technologies is crucial, as digital twins often rely on data from IoT sensors and devices to replicate real-world conditions.
- Cloud computing: Experience with cloud platforms (for example, AWS, Azure, Google Cloud) to host digital twins and manage the vast amounts of data they generate.
- Data management and integration: Skills in managing data from various sources, ensuring its quality and integrity, and integrating disparate systems and technologies.
- Cybersecurity: Knowledge of securing digital systems, protecting data privacy, and ensuring compliance with relevant standards and regulations, given the sensitivity and importance of the data involved.
- Project management: Ability to manage projects, including planning, execution, and collaboration across different teams and disciplines.
- Domain-specific knowledge: Understanding the specific industry and the physical systems being modeled, which is crucial for creating accurate and useful digital twins.
8. Where does Unity fit into the DT pipeline?
The Unity Editor, as a real time engine, is ideal for developing applications that leverage the diverse data sources that make up digital twins.
Using the Unity Editor, you can import CAD models and keep all the important metadata from CAD and BIM applications connected. The Unity Editor lets you tap into IoT sources, pull in data from online streams, integrate various systems, and then roll everything out across multiple platforms as fully functional applications.

9. Creating a simple digital twin with Unity
To help you understand how the Unity Editor can fit into the workflow within a digital twins project, follow the instructions below: This will also demonstrate how digital twins can be useful in safety planning and AI navigation.
1. Download, extract, and open the provided project.

2. From the main menu, select Assets > Scenes to open the Fire_Simulation_Start scene.
3. In the Hierarchy window, select the Office Floor Model.rvt GameObject and use the foldout (triangle) to expand it.
The Office Floor Model.rvt GameObject is a CAD model that was imported with the Pixyz Plugin from Autodesk Revit.
4. Select some of the building components in the Hierarchy window to see the metadata component in the Inspector window.
The metadata component was created for each imported building part by the Pixyz plugin when the model was imported from Revit. This is an example of one of the numerous ways the Unity Editor can access data to create digital twins.

5. Select the AddNavmesh GameObject in the Hierarchy window.

6. In the Inspector window, find the Add Navmesh to Surface component and select the Add NavMeshSurfaces to Tagged Objects button.

This script iterates through all the objects in the building model and uses the metadata to find the floor objects. Once a floor is detected, it adds a navmesh component and then bakes the scene navmesh.

Run the simulation
7. Enter Play mode to run the simulation.
8. Click and drag the slider to add more test dummies to the simulation.
9. Click a spot on the floor to set the fire point of origin.
10. Select the Start Simulation button.
When you run the simulation, it will determine where the closest exit door to each dummy is based on the metadata and use the AI navigation features of Unity to move all the dummies to the nearest exit. The simulation will stop automatically after 30 seconds.
This is a very simple example of a level 3 digital twin. You started with a digital representation of the floor layout (level 1), then simulated a fire alarm going off and people moving to the exits (level 2), and finally, you used the simulation to test how long it would take to evacuate the building based on different scenarios (level 3).
10. Next steps
In this tutorial, you learned the basics of digital twins, including their implementation, benefits, risks, necessary skills to implement, and explored practical examples.
If you are interested in learning how to create your own advanced digital twins in Unity, check out our on-demand training platform where you will find a range of courses. For more information about the many use cases for digital twin solutions built in Unity, including case studies, demos, and on-demand webinars, check out more resources about Digital Twins or speak to our expert team today.