This article will explain the most important aspects of Unity Sample Project available free-of charge on our website. It works out-of-the-box with Extremely Simple Unity Integration sample LightAct project, that is available in the Intro Window under the Unity tab
Please note, this is not a tutorial on Unity. We will be explaining only the outline of aforementioned sample project. If you are looking for general Unity instructions, please refer to Unity documentation.
If you are having problems with integrating LightAct plugins specifically, you may ask a question on LightAct Answerhub and we will try to help you as much as we can.
Sending a Texture to Spout
When you open Unity project you should see something similar to this (we’ve already highlighted the most important parts for you):
On the left side, you’ve got Hierarchy tab where all the GameObjects are listed. The most important ones for Texture sharing are Receiver, which is receiving a texture from Spout, and Sender, which, obviously, is sending it. First, we are going to explain the Sender, and then, at the end of this article, the Receiver
Sending Spout from Unity
First, let’s select Sender GameObject in the Hierarchy tab.
You will see that it is a camera and that it has SpoutRenderTexture.0 set as the Target Texture. This means that whatever this camera sees is rendered not to a display, but to a Texture.
In its properties on the right, you’ll also see the 2 scripts attached to it. SpoutSender takes care of sending Spout from the camera and InvertCamera script takes care that the texture appears correct.
Please note the Sharing Name property which you have to type into LightAct as well (in Spout Reader node in the Devices window).
Feel free to go through the scripts themselves, which are all saved in the Scripts folder.
Receiving Spout in Unity
Receiving Spout in Unity is even simpler than sending it. You just create a GameObject (mesh of some sort) and apply SpoutReceiver script to it. If you select Receiver GameObject you’ll see this has been already set up for you.
In its properties on the right, you see SpoutReceiver script has been attached to this GameObject. It has just 2 properties. Select sender allows you to either select Any or Other (specify). If you select Any, Spout Receiver is going to choose the first available Spout sender it can find, but if you select Other (specify), you can type in the name of Spout sender. Please note, you should type in the exact name you typed into Spout writer node in the Devices window of LightAct.