Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: nohailokha on August 25, 2018, 11:34:00 AM
-
hi
im getting a trouble in the selection menu . how can i make the selected character
in selection menu scene stay saved when starting game scene
sorry for my bad english
Thaanks first
-
Hi.
You could use playerprefs actions for this.
It will even be saved if you restart the game or you can reset it when starting the game.
For example you could use an int (1 : character one, 2 character two, and so on.
When you load the scene load the int and use a 'Int Switch' to set the character.
-
thanks for your reply . what sould i add in the key variable and the value ?
-
Hi.
The 'key' is a reference to that variable so if you call it "CharacterSelected"
Then you need to use that reference to read or change the value.
The value is the int variable for your selected Character.
So after you selected a character (for example character 3) then you can set that value by using 'PlayerPrefs Set Int' key : CharacterSelected Value : 3 (best to use a variable instead of a number)
in the next scene use 'PlayerPrefs Get Int' key : CharacterSelected and use a variable to get the value (which will be 3)
Now you know Character 3 is selected in the other scene :)
-
thank you but i didnt work i think i m missing something in variables . i wish if you can make an exampleproject for me . Thanks
-
Hi.
I made you a sample, but i used a single scene.
But you can do the same in 2 scenes (top part Scene 1, bottom part Scene 2) once you understand how it works.
just import the attachment below into a project that has Playmaker installed
-
okay thank you so much im gonna try it
-
it finaally works thank touu so much Djaydino .
-
Hi.
Happy to help ;D
-
How do I assign the characters to int?
For example, pressing button 1 will select character 1
Because the example above is directly targeting the button as a character
If I need to separate characters and buttons into different objects, how do I correspond to each other?
-
Hi.
I am not sure what you mean, can you give a sample.
Do you mean a on screen button or a controller button?
-
for example, i have a button that i want to use to choose next car and previous car, but how to click the button to change the car show on the screen
and how to set the car that i choose in my next scene ( or in my gameplay )
like this :
-
Hi.
The Ui Button actions can detect pressing a button.
Then You can save (you can use PlayerPrefs actions to get/set (load/save)) what that button pressed in a variable.
on the other scene load what you selected and get the car prefab you need
-
ok! thank your help! i will try to make this ;)