- Home /
Question by
yaswong135 · Dec 03, 2018 at 10:32 PM ·
scoreonmousedownscoring
How to create a simple score count based on clicked objects?
I'm creating a mini game within a scene which a user clicks on objects to 'collect' them. They are scripted to stop animating once a user clicks on them using OnMouseDown (). I want a way of displaying the score everytime one of them is clicked, but they are all separate game objects with their own animations.
Comment
Answer by k234234w · Dec 04, 2018 at 12:46 AM
You could have a score manager sitting in the scene which keeps track of the score, it also has a reference to the text. When the object that can be clicked on is created it should get a reference to that manager. When the click happens the object should then tell the score manager to adjust the score.