Houdini 20.5 Unity

Session

How to start a session and the different session types

On this page

A Houdini Engine session is needed in order to use the Houdini Engine for Unity plug-in. The session will load the necessary Houdini libraries, start up the Houdini Engine server, and setup the environment and preferences for using Houdini Engine.

The plug-in handles creating and closing the session automatically when loading an HDA or creating Houdini assets inside Unity. In most cases, the user does not need to manage the session. For the more advanced user, or if want to debug a session-related issue, there are session tools available via the HoudiniEngine ▸ Session menu.

Additionally, the Session can be configured in the HoudiniEngine ▸ Plugin Settings window, under the Session section.

Session Architecture

It might help to understand how Houdini Engine works, though for most users this isn’t necessary.

There are 2 main pieces to the architecture. First is the server which we call HARS. It can run standalone via the HARS executable found in Houdini bin folder. Or we can start it inside Houdini itself, for example using Houdini Engine SessionSync. The HARS server handles the Houdini-specific work. This server allows plugins to connect through use of a client library which we call HARC.

The plugin will automatically start the HARS server or it can be started manually from the HoudiniEngine ▸ Session ▸ Create menu (see Create a Session). Or can connect to an existing HARS server from the HoudiniEngine > Session > Connect menu (see Connect to Session).

The plugin uses the HARC client library to then communicate with HARS.

Session Menu

The Session Menu allows to manage the Houdini Engine session from Unity.

  1. Create ▸ Pipe Session Manually create a Pipe session and use as current default session. Closes existing default session. (see Pipe Session).

  2. Create ▸ Socket Session Manually create a Socket session and use as current default session. Closes existing default session. (see Socket Session).

  3. Connect ▸ Pipe Session Manually connect to an already running HARS server using a Pipe session and use as current default session. Closes existing default session. (see Pipe Session).

  4. Connect > Socket Session__ Manually connect to an already running HARS server using a Socket session and use as current default session. Closes existing default session. (see Socket Session).

  5. Session Info Open the Session Info panel. Helpful for troubleshooting session-related issues.

  6. Close Default Session Close the default session.

  7. Close All Sessions Close all open sessions.

  8. Reconnect To Session If a session is open and was in use, this can be used to reconnect to it if Unity loses connection to it. This is done automatically after a Unity code recompile (Editor state is reset), and we want to continue using the Houdini session we were using before.

  9. Restart Session This will close the current (default) session and re-create it. This is very useful in situations where the Houdini session gets into an error state where it fails to load or cook assets. This will restart the session allowing the user to continue to work without needing to restart Unity.

Session Types

Pipe Session

A named pipe session allows the main Houdini Engine processing to happen in a separate process, outside of the Unity process. The named pipe is used for inter-process communicate between the Unity process and the Houdini Engine process. This is the recommended method when using the Houdini Engine for Unity plug-in.

Socket Session

A Socket Session allows the main Houdini Engine processing to happen in a separate process, outside of the Unity process. For socket sessions, a TCP socket is used to communicate between the Unity process and the Houdini Engine process.

Create a Session

By creating a session, the HARS server is started manually, and the plugin connects to it. This is done by using menu HoudiniEngine > Session > Create. Then it can be closed via HoudiniEngine > Close All Sessions. Note the HARS server created will be running on the local machine.

Connect a Session

By connecting to a session, this assumes that the HARS server is already running. The plugin connects to it which can be done by using menu HoudiniEngine > Session > Connect. This might be useful for when running HARS on a remote machine.

To connect to a remote HARS server, follow these steps. For running HARS locally, you can skip steps 1-6, and assume remote means local.

  1. Install Houdini on remote machine.

  2. Create a folder on your local machine: C:\\HEngine\\bin

  3. Copy libHAPIL.dll, libHARC.dll, and libHAPI.dll from the remote machine’s Houdini installation folder (e.g. C:\\Program Files\\Side Effects Software\\Houdini 18.0.460\\bin) to local machine folder C:\\HEngine\\bin

  4. Open Unity on local machine. Go into menu HoudiniEngine ▸ Plugin Settings ▸ GENERAL ▸ Override Houdini Install Path, and set C:\\HEngine (note the missing bin folder, but using the parent only)

  5. Restart Unity on local machine.

  6. Start HARS on remote machine using socket mode: C:\\Program Files\\Side Effects Software\\Houdini 18.0.460\\bin\\HARS -s 9090

  7. Back in Unity, go into menu HoudiniEngine ▸ Plugin Settings ▸ SESSION and make sure the Socket Session Host Name has the right IP or host name, and Socket Session Port is 9090.

  8. Go into menu HoudiniEngine ▸ Session ▸ Connect ▸ Socket Session

It should connect successfully, allowing you to use the plugin features. If it fails, check the pop-up dialog window or the log console for information on the error and workarounds (see Session Troubleshooting).

IMPORTANT: If connecting to a remote HARS server, for loading HDA and other required files, they need to be accessible by the HARS server. It is recommended to use a network shared drive accessible on both the local and remote machine by the same paths.

Houdini Engine SessionSync

Houdini Engine SessionSync can be helpful when learning to use Houdini Engine and creating HDAs, or troubleshooting HDA issues. For more information, see SessionSync.

Session Troubleshooting

If you are getting session creation or connection issues, try the following steps:

  1. Check that the connection settings in HoudiniEngine ▸ Plugin Settings ▸ SESSION are correct. Make sure pipe name is valid if using pipe session, or server name and port are valid if using socket session. Revert to defaults if not sure.

  2. Force close and reset sessions via HoudiniEngine ▸ Session ▸ Restart Session. This closes the current session and creates a new session without any assets loaded. Once restarted, existing assets in the Unity Scene can be recooked by changing their parameters or by invoking Recook via the Inspector UI. Recooking will automatically load the asset into the new Houdini Engine session.

  3. Check that Houdini is installed at the correct location that the plugin expects. You can override this location in the plugin settings: HoudiniEngine ▸ Plugin Settings ▸ GENERAL ▸ Override Houdini Install Path.

  4. Restart Unity and try again.

  5. Open the process manager, and kill an HARS processes on the local machine.

  6. Restart the local machine or reinstall Houdini and the Unity plugin.

If all else fails, please contact support@sidefx.com with details of the problem, including the any log errors or pop-up dialog messages, Unity and Houdini version, and licensing information.

Unity

Getting started

Project Setup

Using Houdini Engine

Reference