Simple Score System using Playmaker in Unity3d

preview_player
Показать описание
Sorry for the white on white and small text size for the score.

Here's the step by step:

- create empty game object called 'manager'
- this will handle the math and update the score and such

- rename first state to 'IDLE' and add 'FINISHED' transition
- this is the start state, does nothing

- create 'ADD POINTS' event and check to make global

- make a new state called 'ADD' and add global transition 'ADD POINTS'
- this is where math for adding score will be done

- create an 'UPDATE' state which will update the score

- on 'ADD' state add action: int add
- this tell the manager what to add to score

- create a global variable called 'pointsReward'
- change type to 'Int'

- On the 'Int Add' action in the 'ADD' state
- select 'int variable' as 'pointsReward'
- add 1 (or how many points to add to score)

- add 'FINISHED' transition to state and connect to 'UPDATE'

- create a new variable called 'scoreString'
- change type to 'String'
- this will convert the integer into a string so it can be displayed

- In 'UPDATE' state
- add action Set Gui Text (this will display the score)
- set game object as 'GUI_score'
- set text as 'scoreString'
- add action 'Convert Int to String'
- set 'int variable' as 'pointsReward'
- set 'string variable' as 'scoreString'

- in 'SCORE' state
- add action 'send event'
- event target: Game Object FSM
- GameObject: specify game object (select 'manager')
- FSM name: FSM
- Send Event: ADD POINTS
- add transition 'FINISHED' and connect back to 'IDLE'
Рекомендации по теме
Комментарии
Автор

In 2024 the GUI text is not existing, so what can I do now? :(

saraj
Автор

DO MORE DO MORE, you explain this stuff  better than anyone else on youtube, really helped me out.

wolff
Автор

I don't have the action "Set Gui Text". What i have to do?

agustin
Автор

Great tutorial!!!

My coin count (Coins Collected) keeps resetting to "0" after player dies and game restarts....I would like it to continue counting from the amount collected.Do you have a tutorial on how to do this using playmaker?

CyborgSambeats
Автор

Hi, the score is working and everything is fine. But as soon as I can make it a prefab and drag it into the scene it is't counting the score, do you have any suggestion to why this is happening?

sebastiankay
Автор

Hi great tutorial, and it works well but excuse my ignorance, how do you do this with two players interdependently scoring points ? ei not global ?

ufencevr
Автор

Thanks for the tutorial. I am having an issue with the Send Event towards the end. My '_Manager' object does not show up in the list. It was an Empty Object.

conancrushar
Автор

how the fuck do you get the score to display on screen for fucks sake

aaronhend
visit shbcf.ru