i wanna set the slider to rotate an object between -60 and 60
so i wrote this code but it didn’t work (HELP)
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class rotateplayer : MonoBehaviour {
public Slider slider;
public GameObject Player;
public void Adjustrotate ()
{
Player.transform.Rotate(0, slider.value*Time.deltaTime, 0);
}
}
public class rotateplayer : MonoBehaviour
{
public Transform Player;
public void Adjustrotate ( float angle )
{
Player.Rotate(0, angle, 0);
}
}
Then, select the Slider, and in the onValueChanged box, click on the + symbol, drag & drop the object holding the rotateplayer script, and select the rotateplayer > Adjustrotate (Dynamic) function. Don’t forget to set the min anx max value of the slider to (-60,60) in the inspector