Thursday, November 27, 2014

Unity touch debugging

I mentioned this in an earlier post, but thought I would go into more detail. I think this is  a great solution for testing touch input with Unity.

http://docs.unity3d.com/ScriptReference/Input.GetTouch.html

I'm using Visual Studio Pro 2013 to do this and I don't see a way to do it with Mono.  The only other way I've found is to use an actual device and connect a debugger to the device. This way I've found allows me to simply run a Visual Studio project directly on my touch device/development environment and test my touch code.

The first thing is to Build the project using File/Build and Run

 

 Select Windows Store app and then click Build or Build and Run.

 
The default location is to use the winout directory in the current Unity project. This worked well for me so I just used the default.
 
 
This creates a .sln file in that winout directory with all the necessary Visual Studio project files. Simply double click on the .sln file to launch Visual Studio Pro 2013.
 
 
 
I tested the project and one really nice thing is that the .cs files associated with behaviors in my project are actually linked back to the same files in my Unity project. So after making changes, they are already in my Unity project and I don't have to copy them back.
 
 
 
One thing to note is that this is only for script debugging. If I want to make changes to my layout or the models I've laid out in my Scene I will have to close Visual Studio, return to Unity to make the changes, then rebuild the winout project to work on my scripts again.  It's a small thing and this is still a much easier way to debug touch input than anything I've had to do before.

 

 

 

No comments: