MenuToggle Menu

Unity Plugin

ProtoPie Connect allows users to embed Unity layers via Custom Layer Integrations. The ProtoPie Unity Package is a Unity plugin that enables ProtoPie and Unity layers to send messages to each other, allowing for integrated interactions between the two platforms.

This Unity plugin is free to download and install. However, adding Unity interactivity through the plugin is exclusively for Connect Enterprise users. If you are an Enterprise user and wish to try the ProtoPie Unity Package before its official release, please contact

⭐ Coming soon: The ProtoPie Unity Package will soon be available for download from the Unity Asset Store.

Workflow for Integrating Unity with ProtoPie

To prototype integrated interactions between ProtoPie and Unity, we suggest the following workflow:

1. Define the message set (mapping table) to be used for communicating with Unity. The Pies will interact with Unity via messages using Send/Receive features.

  • In ProtoPie, messages in the Send response trigger events in Unity. When Unity sends a message to ProtoPie, messages in the Receive trigger serve as the identifier for the appropriate responses in ProtoPie.

2. In the Unity project, install the Unity Plugin (ProtoPie Unity Package).

3. In the Unity scene, define the mapping between ProtoPie messages and Unity events.

4. When ready to test together, export the Unity scene as a WebGL build and add the build files as source files to the Unity layer in ProtoPie Connect.

5. Arrange the ProtoPie and Unity layers according to the desired layout and test the interactions together on the Stage View in ProtoPie Connect.

Unity Plugin Overview

  • The plugin is installed in the Unity project as a package and allows one to map ProtoPie messages with Unity events without having to write any code. The plugin can be added to existing Unity projects in an unobtrusive manner and doesn’t interfere with or break any existing Unity components.
  • The plugin works by creating a ProtoPie object inside the Unity scene and utilizing the script component Message Interaction (provided by the package). The ProtoPie object is responsible for mapping the ProtoPie messages with events in Unity. Because the ProtoPie object handles all the mapping between the two platforms, there is no need to customize the Unity code elsewhere to make this integration happen.
  • In the Message Interaction script component, one assigns a mapping table to use with the Unity scene. The mapping table is essentially a list of messages to be used between ProtoPie and Unity. Once a mapping table has been assigned, the user can add the Event(Unity)-Message(ProtoPie) Mappings to be used in the Unity scene.
  • In the Event(Unity)-Message(ProtoPie) Mappings, the user can designate the message mapping to use in the scene, the message direction, the desired action in Unity, the values to send back to ProtoPie, etc.

Unity Plugin Installation and Setup

1. In the Unity Project, install the ProtoPie Unity Package.

2. In the Unity scene, create an empty object and name it "ProtoPie".

  • The name must be "ProtoPie" (case sensitive) because ProtoPie Connect detects the object for message interactions using that name

3. Add “MessageInteraction.cs” (from ProtoPie Unity Package) script component to the ProtoPie object.

4. Select Add Component → Scripts → ProtoPie.Interaction → Message Interaction.

[object Object]

4. Add MappingTable to the Message Data field in the Message Interaction component.

[object Object]
  • The MappingTable, in essence, defines the message set to be communicated between ProtoPie and Unity.
  • It is a configuration file in YAML format, which allows you to specify the labels, the message to be transmitted, and the message flow direction.
  • The mapping table is located in the package folder named MappingTablet.asset. Here, you can add/remove/edit the entries in the message mapping list.

5. The Unity scene is now ready to be used with ProtoPie Connect. Add your first mapping by pressing the Add Mapping button under Event(Unity)-Message(ProtoPie) Mappings.

Message Mapping in the Unity Plugin

[object Object]

ProtoPie and Unity layers communicate via messages to add interactivity between them.

To add a message mapping, select Add Mapping to define which mapping to utilize. For each mapping, you will be able to select one of the mappings defined in the mapping table (the one used in the Message Data field).

Attribute Definitions

  • Mapping Label: the label or index of the mapping defined in the mapping table.
  • Message: The message (or messageID in socket.IO terms) to send/receive between ProtoPie and Unity. This will correspond to the message in ProtoPie’s Send Response and Receive Trigger.
  • Message Direction: The direction of message communication (ProtoPie to Unity, Unity to ProtoPie, Both Ways, None).
  • Desired Action (String): The action (method/function) that should be executed in Unity when ProtoPie sends the corresponding message to Unity (Applicable only when Message Direction is ProtoPie to Unity and Both Ways).
[object Object]
  • The user should select the source object and the method to execute the action.
  • If ProtoPie sends a value along with the message, that value can be passed along as a String parameter to the action (method/function)
  • Note: The 'addCube(string)' option under 'Static Parameters' is not configurable at runtime. Instead, the string value must be predefined within the Unity Editor prior to building the project.
  • Event Object & Event to trigger message: The Unity object and event that would trigger Unity to send the message to ProtoPie (Application only when Message Direction is Unity to ProtoPie and Both Ways).
  • Value Source Object & Value to Send: (Optional) When sending a message from Unity to ProtoPie, additional data can be sent to ProtoPie via the message’s value. The Value Source Object and Value to Send attributes define what kind of data to send back to ProtoPie.
    • Note: The plugin will recognize public string variables attached to the source object.
Back To Top