Unity 4.3.4 completely freezes with third person script

Below is a very nice 3rd person camera script that I made following a tutorial on 3DBuzz. Whenever I put the TP_Controller.cs script on a biped or character and click play, the entire Unity 4 client freezes. I’ve tried contacting 3DBuzz to see if they could help see why Unity 4 is freezing but I’ve heard no response. Their forums are full of unanswered questions.

So is there anyone here that can test this on Unity 3 which is what 3DBuzz made it for. Or try it out for themselves to see why it’s crashing? I don’t even get a debug or error log message. It’s just a hard freeze and I have to close Unity with TaskManager. It seems like there should be a failsafe built in to Unity avoid such a big crash.

To use the script all you need to do is attach TP_Camera, controller, and the motor C# scripts to a character. Make sure the helper.cs is with the other scripts. It’ll automatically create a camera if one doesn’t exist.

Helper.cs - http://pastebin.com/VwUghR0s

TP_Camera.cs - http://pastebin.com/X5JizCHE

TP_Controller.cs - http://pastebin.com/V5pHi1Mr

TP_Motor.cs - http://pastebin.com/NPGPEKkQ

This is because your Helper.ClampAngle method.

These freezes are usually because of infinite loops.

I think you meant for it to be like this

do
{
     // If angle is less than 360 - add 360
     if (angle < -360)
	    angle += 360;
		
     // If angle is greater than 360 - subtract 360
     if (angle > 360) /***** you had -360 ****/
	    angle -= 360;
			
} while (angle < -360 || angle > 360);