playMaker

Author Topic: character selection menu [SOLVED]  (Read 3749 times)

nohailokha

  • Playmaker Newbie
  • *
  • Posts: 8
character selection menu [SOLVED]
« 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
« Last Edit: August 28, 2018, 05:22:06 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: character selection menu
« Reply #1 on: August 25, 2018, 12:51:19 PM »
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.

nohailokha

  • Playmaker Newbie
  • *
  • Posts: 8
Re: character selection menu
« Reply #2 on: August 25, 2018, 10:23:22 PM »
thanks for your reply . what sould i add in the key variable and the value ?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: character selection menu
« Reply #3 on: August 26, 2018, 12:03:13 AM »
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 :)

nohailokha

  • Playmaker Newbie
  • *
  • Posts: 8
Re: character selection menu
« Reply #4 on: August 26, 2018, 10:31:15 AM »
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

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: character selection menu
« Reply #5 on: August 26, 2018, 11:48:57 AM »
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

nohailokha

  • Playmaker Newbie
  • *
  • Posts: 8
Re: character selection menu
« Reply #6 on: August 27, 2018, 03:44:12 AM »
okay thank you so much im gonna try it

nohailokha

  • Playmaker Newbie
  • *
  • Posts: 8
Re: character selection menu
« Reply #7 on: August 27, 2018, 07:25:05 AM »
it finaally works thank touu so much Djaydino .

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: character selection menu
« Reply #8 on: August 28, 2018, 05:21:49 AM »
Hi.
Happy to help  ;D

bbs950064

  • Playmaker Newbie
  • *
  • Posts: 12
Re: character selection menu [SOLVED]
« Reply #9 on: November 03, 2020, 02:30:12 AM »
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?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: character selection menu [SOLVED]
« Reply #10 on: November 03, 2020, 01:45:03 PM »
Hi.
I am not sure what you mean, can you give a sample.

Do you mean a on screen  button or a controller button?

bbs950064

  • Playmaker Newbie
  • *
  • Posts: 12
Re: character selection menu [SOLVED]
« Reply #11 on: November 07, 2020, 01:19:26 AM »
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 :

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: character selection menu [SOLVED]
« Reply #12 on: November 07, 2020, 01:22:23 PM »
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

bbs950064

  • Playmaker Newbie
  • *
  • Posts: 12
Re: character selection menu [SOLVED]
« Reply #13 on: November 30, 2020, 07:49:02 PM »
ok! thank your help! i will try to make this  ;)