"Restricting" a GameObject to just X & Y axis

Hey there, I creating a 2d side-scrolling game and I want the whole game to completely out rule the Z axis. Simple question really.. is this possible, if so how do I go about it.

Thanks -C

Unsure if this is what you are looking for but to stop an object moving on the Y Axis use.

transform.eulerAngles = new Vector3(0,transform.eulerAngles.y,0);

Untested*

Peace, Aaron Lewis

Hi!, I'm not an expert but i did something like that a few weeks ago Following this Tutorial by Will Goldstone, the script in the tutorial is really basic and I guess your's is 100 times more complex and elaborated that this one, but This might give you an idea of how to do it :D

Click here for the Tutorial!

If you're using a rigidbody component, you can check it's properties in the Inspector panel, and in the option "Constraint" you can fix the Z position.

Check out the 2D Side Scrolling tutorial at:

http://unity3d.com/support/resources/tutorials/2d-gameplay-tutorial.html