how to rotate an object between two angles

Hello everyone.

I’ve an empty object (its a point which is an rotation point and another object imported from Maya) which is a child to this object.
How to rotate this object between for example two angles (-120 and 120 ) on axis y?

These are pieces of code you will need.

private Quaternion localRotation;

localRotation.y = Mathf.Clamp(value, -angleLimit,angleLimit);

transform.rotation = localRotation;

for Mathf use namespace - > using System;

value can be anything depending on your need like speed*Time.deltatime, or inputAxis. Anglelimit should be of float declared before , or just use raw float value here