- Home /
Question by
ChompIV · Jun 13, 2017 at 10:51 PM ·
getcomponentplayerprefsfloatmouselooksensitivity
How do I take a public float from a different script and access it
I need to take the XSensitivity float from the mouse look script to make my slider. Here is what I have and I'm VERY lost :( I want to acess the XSensitivity value from the mouselook script and then use it to make the slider and have the value save.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class sensitivitySliderScript : MonoBehaviour {
public float xFloat;
void Update () {
PlayerPrefs.SetFloat("currentX", MouseLook.XSensitivity);
MouseLook.XSensitivity = PlayerPrefs.GetFloat("currentX", 0);
}
}
Comment
Your answer
Follow this Question
Related Questions
How to use PlayerPrefs to save to floats (Sensitivity Help) 0 Answers
Get a float from a different GameObject? (MouseLook) 1 Answer
Mouse Look Y Sensitivity doesn't change 3 Answers
GetComponent Problems with Networked FPS System 0 Answers
Why will Playerprefs not save my score on Android / iOS? 2 Answers