- Home /
How can i change slider of Range in Update method while the game is running ?
[Range(1, 100)]
public int stepsPerBatch;
Then in a method:
private void BeginGame()
{
mazeInstance = Instantiate(mazePrefab) as Maze;
StartCoroutine(mazeInstance.Generate(stepsPerBatch));
}
Now i want to make that if i change the range slider while the game is running it will take effect in real time.
what do you mean? change the Range attribute to other value like 1, 200?
When do you start BeginGame
.Just one time in the beginning? Then changes would have no effect. Generally changes at the slider are recognized by the scripts in real time. You can test it in the Update funtion, with print(stepsPerBatch)
I have this:
[Range(1, 100)]
public int stepsPerBatch;
private void Update()
{
print(stepsPerBatch);
}
On inspector, if move the slide bar, console prints the value update correctly on real time. Im sorry but I dont understand what do you mean.
I thought that was the question...Changing the slider takes effect in real time.
Your answer

Follow this Question
Related Questions
Why when i color the 4 walls or getting all the blocks from the 4 walls they are not equal ? 0 Answers
How can i attach a script to many gameobject in array ? 1 Answer
How can i set audio mixer groups volume to be used with ui slider when 0 is lower and 80 louder ? 1 Answer
How can i make enum choice to not pause the game ? 0 Answers