I was trying to make a slider element in my settings menu to allow the player to change the mouse sensitivity on a range of 0.1 to 7, but when I added a Slider variable, I couldn’t see it in the inspector, (Image below) which meant I couldn’t properly set it’s value.
Here’s a bit of my code to further explain what I mean:
using System;
using UnityEngine;
using UnityEngine.UIElements;
[RequireComponent(typeof(CharacterController))]
public class FPSController : MonoBehaviour
{
[Range(0.1f, 7f)]
public float lookSpeed = 2f;
private readonly Slider lookSpeedSlider;
//other variables
void Update() {
lookSpeed = lookSpeedSlider.value;
//more irrelevant code
}
}
Any help is appreciated, whether it’s a solution, further explenations/instructions on what to do or a work-around.
thanks in advance.