Creating a Unity-based simulator
Note: This tutorial has been tested for Unity version 2022.3
In this tutorial, we’ll use the Unity game engine to create a simple, not-so-fancy simulator that serves as a barebones boilerplate for Unity-based simulators prepared for distributed simulation using the Inhumate RTI.
You’ll create a simple “walking simulator” where the player can move around using W, A, S, and D, drop boxes, and interact with the physics engine. Not exactly an exciting player experience, but it is a straightforward way to structure the project to take advantage of Inhumate Suite features. The simulator will support recording, playback, co-simulation (multiplayer), and much more.
Setup the project
Create a new Unity project and prepare it with the Inhumate RTI Unity integration package.
Note: To complete this section you will need Nodejs 18 or above.
-
Create a new Unity project using the Core 3D (Built-In Render Pipeline) template.
-
Add the Inhumate RTI Unity integration package to your project using the OpenUPM command-line tool:
# Install openupm-cli npm install -g openupm-cli # Go to your unity project directory cd YOUR_UNITY_PROJECT_DIR # Install package: com.inhumatesystems.rti openupm add com.inhumatesystems.rti
Verify that the package has been added in your project folder under Packages.
Create the environment
In this section, we’ll create a simple enclosed arena to serve as the playing field and an interactive box prefab.
- Rename the current scene (optional) to
Demo. - Make a square “arena” by using a plane and cubes. See image below for reference.
-
Create a Rigidbody cube and name it
Box. Save as prefab and remove.
Create the player
Next, we’ll set up the player and enable basic movement and spawning of boxes.
- Create a Rigidbody capsule and name it
Player. - In the inspector, scroll down to the Rigidbody component. Set
Mass,Drag, andAngular Dragall to 10. FreezeXandZrotation inConstraints. - Add a camera as a child in the player object. This will be your point of view when playing. Adjust it to your liking and make sure it has higher
Depththan your scene camera. -
Make a simple player controller script that moves the player with
W,A,S, andDand instantiate the cube prefab by pressingB.Start by adding your members and initialize your rigidbody:
public float force = 1000f; public float torque = 50f; public float cubeSpawnDist = 3f; public new Camera camera; public GameObject boxPrefab; Rigidbody rb; // Start is called before the first frame update void Start() { rb = GetComponent<Rigidbody>(); }Add the
FixedUpdate()function and add your code for the player movement:void FixedUpdate() { // Forward / Backward movement if (Input.GetKey(KeyCode.W)) { rb.AddForce(transform.forward * force, ForceMode.Force); } if (Input.GetKey(KeyCode.S)) { rb.AddForce(-transform.forward * force, ForceMode.Force); } if (Input.GetKey(KeyCode.A)) { rb.AddTorque(0, -torque, 0); } if (Input.GetKey(KeyCode.D)) { rb.AddTorque(0, torque, 0); } }And instantiate your box prefab in
Update():void Update() { // Instantiate boxprefab when pressing B, cubeSpawnDist units from the player if (Input.GetKeyDown(KeyCode.B)) { Instantiate(boxPrefab, transform.position + transform.forward * cubeSpawnDist, Quaternion.identity); } } - Attach the script and add your box prefab. Try playing the scene. Move around, drop boxes and interact with them while being constrained by the arena.
At this point, the player, boxes, and arena are set up. You can now explore the basic features of the Inhumate Suite in this environment.
Add RTI components
Let’s add some components from our RTI Unity integration package and then look at the results in Inhumate Viewer.
Note: These components determine how objects are represented in the Viewer and handled in the RTI. Feel free to change the values to suit your needs.
-
Add
RTI Static Geometrycomponent to the arena walls and floor.
-
Add
RTI EntityandRTI Positioncomponents to the player. Set theTypeandSizeproperties.
-
Add
RTI EntityandRTI Positioncomponents to the box prefab. Set theTypeandSizeproperties.
Start Inhumate Viewer. When you run the project, you should see the player and the arena in the 3D tab in the viewer.

Support runtime control and scenario loading
Now we’ll prepare the project for runtime control and scenario loading using the RTI by creating a new scene and some configuration.
- Create a new scene and call it
Home. - In the new scene, create an empty object and add the
RTI Connectioncomponent. -
Create a RTI scenario in the project window and type the name of the previous “arena” scene in
Scene Name.
-
Add the scenario in the
RTI Connectioncomponent in yourHomescene.
- Add both scenes in your build settings.
Now, if you run the project from your Home scene, you should be able to select your scenario and press Load from the runtime control in Inhumate Viewer. Your Demo scene has now loaded. Press Start and run around, spawn and interact with boxes and see the viewer mirror your actions. Try the other controls: Pause, Stop, and Reset.
Add the runtime control panel
If you want to access the runtime controls from your Unity scenes, you may add the RTIRuntimeControlPanel prefab from the package to your scenes. Create a Canvas and add the prefab.

Support playback and co-simulation
To support playback and co-simulation, the scene needs an RTI spawner that dynamically adds entities (the player and spawned boxes).
- Save the player as a prefab and remove it from the scene. Spawning will be handled by the RTI spawner.
- Create a copy of the player prefab with the controller script excluded. Name it
PlayerPlayback. This object will act as a “remote representation” during playback, ignoring any inputs. - Create an empty object in your
Demoscene and add theRTISpawnercomponent. - Create multiple empty objects and place them around the arena. These will act as spawn points.
- In the spawner component, add the box and player playback prefabs in
Spawnable Entities. - Add the
RTIUnknownEntityprefab from the package toUnknown Prefab. -
Specify the player prefab and add the player spawn points.

With this setup, you are ready to test playback and co-simulation using Inhumate Recorder.
- Load a scenario, press
Start, play for a bit, then pressStopfollowed byPlay. - Replay earlier recordings using the three dots menu and selecting
Play. - Run another instance of the project to test co-simulation and verify you can see the other player.
Conclusion
You have now completed the basic setup for integrating the Inhumate Suite with a Unity project. Playback and co-simulation should be working, and you are ready to continue experimenting with additional features and configurations.