Unity Object Angle Detection Script is a Unity MonoBehaviour for reading, setting, adding, and smoothly animating a GameObject Z-axis angle, useful for gauges, needles, indicators, and rotation-based UI/gameplay systems.
Designed for Unity beginners, gameplay programmers, UI tool builders, simulation developers, and anyone needing simple angle control in 2D or 3D scenes.
- Set a GameObject Z rotation directly from code.
- Add or subtract angle deltas from the current rotation.
- Smoothly animate angle changes over time.
- Expose the normalized 0-360 Z angle as a public value.
- Use keyboard shortcuts for quick testing and calibration.
Copy pivot_angle_script.cs into your Unity project and attach it to the GameObject whose Z rotation you want to control.
Call SetZAngle, AddZAngle, or SetZAngleSmooth from your own scripts, or use the configured test keys for manual angle changes.
Unity angle detection, Unity Z rotation script, Unity gauge needle script, Unity rotation controller, Unity MonoBehaviour angle helper, object angle detection Unity
unity, csharp, math, rotation, trigonometry, gamedev