Tag Archives: Networking

Arduino <3 Unity

I’ve recently bought myself an Arduino Uno R3 kit and I’ve built myself some simple projects to get a feeling of what is possible with this stuff! Having little to none experience with microcontrollers I must say the Arduino is quite simple to get into, and the community is awesome with ALOT of tutorials and questions answered online! Much like the Unity community! One of my first projects was to try to get the arduino to communicate with Unity! My plan was to make a gyro-accelerometer for use with my computer! 

For this I paired the Arduino with a  Wifi-Shield(ESP8266) and a GY-521(MPU6050) 6DOF gyro/accelerometer. I set the esp8266 to be a client, hooked up to my computer as the server. I used a free library for handeling the gyroscope which converts the gyro/accel raw data to quaternion rotation and sends it as a string on the serial line. The ESP8266 transmits the string over TCP to the server. 

In Unity i set up a TCPListener on a seperate Thread that continuesly reads the strings from the Arduino and converts string back to quaternion rotation.

In operation it looks like this:  

 The setup is not very accurate so not very useful, but fun project to get working! 

Now I’ve started working on something else! Bigger, better and more beautiful! 

Unity Networking tutorials

Here’s a quick list of tutorials I have found interesting on Unity Networking.

Brent Farris – Unity Networking tutorials:

Tutorial Playlist

Createathings Unity networking tutorials:

Part 1/4

Part 2/4

Part 3/4

Part 4/4

Sky Arena  Photon tutorials:

These videos are referencing a tutorial asset, that can be bought at the Unity Asset store. I haven’t bought this so I can’t say anything about it. But found the videos interesting either way.

Part 1 – Lesson 1

Part 1 –  Lesson 2

Part 1 – Lesson 3

Part 1 – Lesson 4

Part 2 – Lesson 1

Part 2 – Lesson 2

Part 2 – Lesson 3

Part 2 – Lesson 4

Quill18Creates Multiplayer tutorial:

Part 1/2

Part 2/2

I haven’t decided yet if I wan’t to use PUN or built-in Unity Networking for BattleMaze. Both choices has it’s pros and cons as I see it at the moment, but I think PUN is a little bit ahead.

Do you have any experience with Unity networking? Or PUN? What do you think?

Thank you, Tube

YouTube