GMU:Tutorials/Networking/Controlling Unity with Processing: Difference between revisions

From Medien Wiki
m (→‎Unity: + 6.)
m (→‎Unity: Screenshots!)
Line 53: Line 53:
1. Import the scripts to the Assets folder using drag&drop.
1. Import the scripts to the Assets folder using drag&drop.
If you’re working on a real actual project it might be best to create a folder for all your scripts. <br>
If you’re working on a real actual project it might be best to create a folder for all your scripts. <br>
2. Create an empty game object (right click in the Hierarchy) and rename it, so you know what it is. <br>
2. Create an empty game object (right click in the hierarchy) and rename it, so you know what it is. <br>
3. From the assets you drag the scripts onto the empty game object. <br>
3. From the assets you drag the scripts onto the empty game object. <br>
4. Do not forget to adjust the IP, and the port in the inspector. <br>
4. Do not forget to adjust the IP, and the port in the inspector. <br>
5. In the Inspector you see the public variable gameReceiver within the Osc Receiver Script. Drag the object you want to manipulate from the hierarchy onto the gameReceiver value. By default this value is called “Cube”. <br>
5. In the Inspector you see the public variable Game Receiver within the Osc Receiver Script. Drag the object you want to manipulate from the hierarchy onto the Game Receiver value. By default this value is called “Cube”. <br>
[[File:GameReceiver.png]]<br>
6. If you haven't done it already - Safe! Ctrl+S on Windows, Macs probably do that differently, but you will know that better than me.<br><br>
6. If you haven't done it already - Safe! Ctrl+S on Windows, Macs probably do that differently, but you will know that better than me.<br><br>


Line 84: Line 85:
So you typed all that code and there are no errors but that stupid thing still won't do what it should - try Debug.Logs! Just add them everywhere! They can tell you what parts of your script are accessed after you press Play. <br><code>  
So you typed all that code and there are no errors but that stupid thing still won't do what it should - try Debug.Logs! Just add them everywhere! They can tell you what parts of your script are accessed after you press Play. <br><code>  
Debug.Log("Stakkars meg, som har skrevet 50 Debug.Logs");<br></code>
Debug.Log("Stakkars meg, som har skrevet 50 Debug.Logs");<br></code>
The lines will be written in the console section of Unity once they are accessed.<br>
[[File:50Debug_Logs.png]]


== Example: Make an object jump on clapping ==
== Example: Make an object jump on clapping ==