Slider graphic refuses to update with value
So I need an answer for this one, My slider value changes and sends to other scripts correctly but the actual in game slider doesn't move at all, just a limp red line. heres my code:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class PowerSlider : MonoBehaviour { public void OnValueChange(float value) { Debug.Log("New Value " + value); } public float Values; public Slider PowerS; private bool Continue = true; public bool Stop = false; // Use this for initialization private playerMotor PM; private void Awake() { PM = GameObject.FindObjectOfType(); } void Start () { PowerS.value = Values; PowerS.maxValue = 50f; PowerS.minValue = 1f;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown("space"))
{
Stop = true;
PM.Ustarts(Stop, Values);
}
if (Stop == false)
{
if (Continue == true)
{
Values = Values + 0.5f;
if (Values == 50f) { Continue = false; };
}
else
{
Values = Values - 0.5f;
if (Values == 1f) { Continue = true; };
};
}
}
}
Answer by Keergen · Dec 04, 2018 at 09:57 PM
OH MY GOD!!!!!! ok 48 hours later I just realized i hid the update slider in the START not the UPDATE..... I'm such an idiot XD
Your answer
Follow this Question
Related Questions
Insert normal map in a shader 1 Answer
Why is the color of the player not changing properly? 1 Answer
Namespce Error!!!!!!!!! 0 Answers
BCE0019 'staminaBarDisplay' is not a member of 'PlayerGUI' 0 Answers