Skip to content
Georgios Papadoulis edited this page Oct 16, 2023 · 5 revisions

Welcome to the UnityInputTransfer wiki! This is just a simple guideline to get you started! Might update to a more thorough tutorial later!

First of all, instead of downloading the project, it might be better to create a new one, preferably using Unity 2021.3 LTS (due to 2022 having minor issues with the Editor).

Make sure to install the Input System from the Package Manager. You can either download Mirror or copy the version this project provides. Lastly, make sure to copy the Barebones and Input System Framework folders to your Assets folder.

The framework comes with a pre-made Input Action Asset. Screenshot_13

Test Scenes

There are also two example scenes, one for playing inside the Unity Editor or a build, called Test Server Scene and one for building on a smartphone, called Test Client Scene.

Check the DeviceServerInputControl component in the Device Server prefab. You can add Unity events there. You can also add events in code as indicated by the MoveController.cs script. If you change the map you'll need to hit the Self Initialize on the DeviceServerInputControl's Context menu. If you do that, you'll lose all the events you have manually connected. This might be resolved in later versions. Screenshot_19

For the Phone scene, it's set up so you'll connect with your PC with your IP in the local network and port 5000. Once you build it for the phone and connect, you should be able to move one of the Cubes with the virtual joysticks and control the other Cube's rotation. Also, notice how you can connect more than one devices in the DeviceClient menu. If the dropdowns aren't working correctly, it's because you're in Unity 2022. Check the various controller examples in the Controllers folder to make your own or modify them however you like! Screenshot_17

About the PhonePosition and PhoneRotation

These are made to work when your phone is an AR controller. You'd have to make a new controller that reads from those inputs and pass it to the DeviceServerInputEvents. Also, you'd have to assign the AR Camera transform to the Tracked Motion field in the Device Client. If you simply want to get the rotation of the phone, it's better to use the Attitude sensor which has already been assigned.

Clone this wiki locally