Rotatin the Camera using the UI slider value

Hello, I want to use a slider to rotate the scene camera only in the X-Axis using the UI Slider. If the slider in the middle the camera should look forward, if i crank up the slider the camera should look up and similarly pulling the slider down should make the camera look down. I’m creating a game for android Device and this problem is driving me crazy for the last two days. I know the solution must be really simple but i cant find it after searching for it a lot…
Please , any help would be greatly appreciated.
Thanks…:slight_smile:

Here is the script I made for you.

using UnityEngine;
using UnityEngine.UI;

public class CameraSlider : MonoBehaviour
{
    // Drag & Drop the gameobject holding the slider in the inspector
	[SerializeField]
	private Slider slider ;

    // Drag & Drop the gameobject of your camera in the inspector    	
	[SerializeField]
	private Transform cameraTransform ;
	
	private void Start()
	{
		slider.onValueChanged.AddListener( OnSliderValueChanged ) ;
	}
	
	private void OnSliderValueChanged( float value )
	{
		float angle = Mathf.Lerp( -90, 90, slider.normalizedValue ) ;
		cameraTransform.localRotation = Quaternion.Euler( angle, 0, 0 );
	}
}