Search code examples
c#unity-game-engine2d

2D sprite rotation


I am making a unity game using C# but I want to know how to rotate the player. My 2D sprite falls over a lot but I want to fix it.

This is the code I tried:

transform.rotation *= Quaternion.Euler(0, 0, 0);

Solution

  • Perhaps you want to lock rotation of the attached rigid body? That's a setting in the inspector.