So for this I need to insert names of button into progress bar code!?
I think you donât need the old buttons anymore.
I will have to see the code of your current switch bar to give a useful answer.
I think you need to insert the name (or idâs) of the scènes into progressBar. After the player click the middle button you can switch to that scene.
this is what I haveâŚ
I donât understand what you are trying to achieve with this progress bar script. If you want to switch between scènes you better can use this tutorial: https://developer.playcanvas.com/en/tutorials/ui-elements-stats-counter/
You can change 1/10 for scene1, 2/10 for scene2, etc.
I see your progressBar is a part of that tutorial but I donât think you need that. You need a button instead. You only adjust the function and text of the middle button with the left and right buttons.
Understood, let me check itâŚ
Since I donât know how to do it correctly I would do something like this when the right button is pressed:
if (buttonScene1) {
buttonScene2;
}
else if (buttonScene2) {
buttonScene3;
}
else if (buttonScene3) {
buttonScene1;
}
And with the left button the same but descending.
This is not an exact code but just to give you an idea.
smth like thisâŚ
Yes. Just change the text of the button when clicking left or right. And if the middle button is clicked, check the text of the button and switch to that scene.
I assume that each scene has a name recognizable to the player, so that the player knows which scene he chooses?
Yes
Do you already create a button in the middle instead of the progress bar?
You mean a simple button that I used for changing scenes in previous topic!?
Yes. You place the button in the middle instead of the progress bar.
Step 1: Find out how to change the text inside a button by script.
Step 2: Create a function to change the text of the button to the previous scene name when the player pressed the left button or to the next scene name when the player pressed the right button.
Step 3: Create a function to check the text of the middle button when the player pressed it and switch to that scene.
Yes, I think that is a good place to create that functions.
Are you succeeding?
I will go on tomorrow, 50% of task is done, I know what tasks I need to solveâŚ
Hi,
If I want to insert a set names of scenes in slide button from âChange Scene Scriptâ to âSlide Button Scriptâ how do I need to write it correctly!?
As far as Iâm aware, names are something youâll have to type yourself using the text elements. You can then enable and disable required text elements by using findByName
.