Updating a Unity Application

In Tangible Engine v2 we have migrated from a library that needs to be integrated into your project to a more flexible and modular service model with the goal of making the Tangible Engine easier to use. Additionally, changes to the core software allows for smoother tracking, better rotation, and more customization options to fine-tune recognition.

For clients who are currently using older versions of Tangible Engine with Unity and want to upgrade to Tangible Engine v2, this guide will assist in making the process as simple as possible.

Step 1: Installing the Service

The Tangible Engine Service is a Windows service that runs silently in the background when the touch table is on, and waits for connection requests from client applications. In order to install the service, run the TE2.8_Installer.exe file. At the end of the installation process you will be prompted to select a default profile. Make sure to select the profile that correlates with the size of your Ideum touch table. (If you're using a 55 inch table, select 55_profile.json).

The Tangible Engine Service will start running automatically and any time the computer is restarted.

Step 2: Importing your Patterns

In Tangible Engine v2 we have added engine customization information to the pattern files, which means that pattern files from previous versions of Tangible Engine are not compatible with v2, but can be re-imported and saved in the new format.

If you are using any of the nine standard tangibles, however, Tangible Engine will automatically recognize them as a part of the default profile. The best way to test this is to open the Visualizer by left-clicking on the system tray icon and pressing the Launch Visualizer button. When the Visualizer recognizes a tangible placed on the table, it will display information (see image below).
If you place your tangibles on the table and a tangible visual appears, it means the table recognizes your tangible already and there is no need to train. If, on the other hand, nothing appears, your tangible will need to be trained. In order to do this, you will need to launch the Tangible Engine Trainer application and create a new custom profile with all of the tangibles you intend to use. In the system tray interface, toggle the Table Profile button to Using Custom and select your newly created profile. For information about the Tangible Engine Trainer, see the Trainer documentation.

Step 3: Removing old versions of TE

Depending on what version of Tangible Engine you are upgrading from, some files will need to be removed from your project's game hierarchy. Most likely this includes a GameObject with the TangibleEngine script on it. In some versions there were scripts attached to individual tangible GameObjects that would query the engine for specific patterns.

If there are any scripts in the scene that reference the old TangibleEngine script, they should be commented out or removed.

Step 4: Adding TE v2

Adding the package:

Included in the Tangible Engine v2 installation is an asset package for Unity. To add this package, in Unity click on the Assets->Import Package->Custom Package which will open a dialog. Navigate to the install directory (C:/Program Filex(x86)/Ideum/Tangible Engine 2.8/Bindings/Unity) and select the tangible-engine.unitypackage file. Unity will import all of the needed assets.

Interfacing:

From here, you can either drop the TangibleEngine prefab into your scene and reference it directly or simply call the TangibleEngine.Instance from any script, which will create an instance of TangibleEngine at runtime.

Once your script has a reference to the TangibleEngine instance, it can subscribe to it in a number of ways. Included with the package are three interfaces that provide callbacks for your class:
  • IOnTangibleAdded
  • IOnTangibleUpdated
  • IOnTangibleRemoved
You can also use and event model to subscribe to the TangibleEngine callbacks. An example of both is below.

Interface model:
  
  public class InterfaceDemo : MonoBehaviour, IOnTangibleAdded, IOnTangibleUpdated, IOnTangibleRemoved {
    void Start() {
      TangibleEngine.Subscribe(this);
    }

    void OnDestroy() {
      TangibleEngine.Unsubscribe(this);
    }

    public void OnTangibleAdded(Tangible t) {}

    public void OnTangibleUpdated(Tangible t) {}

    public void OnTangibleRemoved(Tangible t) {}
  }
  
Event model:
  
  public class EventDemo : MonoBehaviour {
    void Start() {
      TangibleEngine.OnTangibleAdded += HandleOnTangibleAdded;
      TangibleEngine.OnTangibleUpdated += HandleOnTangibleUpdated;
      TangibleEngine.OnTangibleRemoved += HandleOnTangibleRemoved;
      }

    void OnDestroy() {
      TangibleEngine.OnTangibleAdded -= HandleOnTangibleAdded;
      TangibleEngine.OnTangibleUpdated -= HandleOnTangibleUpdated;
      TangibleEngine.OnTangibleRemoved -= HandleOnTangibleRemoved;
    }

    private void HandleOnTangibleAdded(Tangible obj) {}

    private void HandleOnTangibleUpdated(Tangible obj) {}

    private void HandleOnTangibleRemoved(Tangible obj) {}
  }
  

Support

If you have any questions or encount any problems with upgrading your Tangible Engine project to v2, please submit a ticket at our support site.
Last Updated: 4/29/2024