Tutorials

Tutorials for the three ways to get OneTouchConnect up and running:

1. Using the demo scene (provided for fast testing purposes)

2. Using the OneTouchConnect Widget (for demos and jams)

3. Using the OTC event handler and publish / browse functions (for seamless embedding in your games)

Demo Scene

Open OneTouchConnect/Demo/OTC Demo
Build on two separate devices.  OneTouchConnect does not work in the editor, you need to build an executable for the relevant platform.
Attach both devices to the same network
Open the app on both devices
Both apps will autopublish a sample service and begin browsing for other services
Once an app has connected or been connected to, browsing / publishing will stop

Widget

Widget can be used in your own games to provide a simple User Interface to allow players to find other devices on the same network. Code can be added to the OneTouchConnectWidget script to perform custom behavior when players connect to each other.

Open OneTouchConnect/Widget/Widget Scene
Build on two separate devices.  OneTouchConnect does not work in the editor, you need to build an executable for the relevant platform.
Attach both devices to the same network
Open the app on both devices
Both apps will autopublish a sample service and begin browsing for other services
Add code to the OneTouchConnectWidget script, OnPlayerConnected
method to trigger your own game behaviour

OTC Events, Publishing and Browsing

To get OneTouchConnect to work naturally within your own game interface, and to use the protocol to identify more detailed information about local devices, developers are able to access the lower level functions and handle publishing and browsing themselves.

Within a game scene, add a
OneTouchConnect/Core/Prefab/OneTouchConnectManager prefab,
or alternately add a OneTouchConnect/Scripts/OneTouchConnectEventHandler
script to an existing, active GameObject
Create custom methods and add these to the relevant static events in the
OneTouchConnectEventHandler script.
For examples see OneTouchConnect/Demo/Code/FrontEndTopLayer
To publish and browse on the same device, call the static method
OneTouchConnectInterface.PublishAServiceAndBrowse with:

  • A service name – usually the device name
  • A service type – usaully product name in service format
    e.g. “
    _yourproductname._tcp.” or “_myproductname._udp.”.  For the protocol to work across platforms, you will need to include an underscore before the service and protocol name, and a . after both.
  • A port – a free port number
To just publish, call the static method
OneTouchConnectInterface.PublishAService with above parameters
To just browse, call the static method
OneTouchConnectInterface.BrowseForServices with the service type (as above)
To stop publishing, call the static method
OneTouchConnectInterface.UnregisterAService
To stop browsing, call the static method
OneTouchConnectInterface.StopSearching

We are  interested in your feedback, please let us know how you find the framework.