I myself solved my trouble
Problem with Slider
I was trying pass value information from slider (UI) to a text (UI).
Image:
But appears the following message:
"UI_Silder.cs(25,24): error CS 1061: 'Slider' does not contain a definition for 'value' and no accessible extension mehod 'value' accepting a first argument of type 'Slider' could be found (are you missing a using directive or an assembly reference?)"
See script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UI_Slider : MonoBehaviour
{
public Text txt;
public Slider sl1;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void SlValores()
{
txt.text = sl1.value.ToString ();
}
}
Answer by waikowenu · Sep 01, 2020 at 06:40 PM
I solved it. The script is correct. My error was because I had created, in another script, a public variable with name slider. Now it is working perfectly.
Follow this Question
Related Questions
UI Text component is not rendering correctly on MAC (sub pixel issue) 0 Answers
How to render text on top of the objects that are generated on the map using a script? 1 Answer
In updating some score text, why should we use the Update function instead of separate functions? 0 Answers
Can't see Text UI in game view 0 Answers
UI Text: Words at end of line jumping to next line 0 Answers