Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by mercedgonzalez259 · Dec 11, 2017 at 05:10 AM · scenelevelspointspoints-counter

How do i make a score system in the main menu.

I have a score system for my other levels(or scenes) I just don't know how to too get all the point from the other scenes and put them in this scene (or main menu) and use it to buy stuff. I've been trying to figure it out for the past couple of days but haven't got anything yet.

this is what my main menu looks like: alt text obviously I still need to work on my design and the way it works is where if you press a button the camera pans to the desired position. As you can see I still have a lot of button and panel designing. Here's what I'm talking about: As you can see the Label of the top right corner is the coin holder. I'm trying to make a script to where it grabs the coins from other scenes and puts it in this one and I haven't had anything work yet. alt text if anyone know how to do what I want it to do then please let me know or show the script... Anything helps. :) thanks.

main-menu2.png (237.9 kB)
main-menu3.png (97.7 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image shadowpuppet · Dec 11, 2017 at 06:37 AM 0
Share

PlayerPrefs would work. Just save your points to that and then retrieve them from main menuscene. Or have an empty Gameobject with your score manager script on it and a donotdestroyonload command so it will get passed on from scene to scene with values

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Ginxx009 · Dec 11, 2017 at 06:47 AM

You can do it by PlayerPrefs.getInt(); so it's something like this.

 PlayerPrefs.GetInt("Score", PlayerPrefs.GetInt("Score") + 1); //just change the 1 value there to another key of the playerprefs so that you will get all the scrores from all your loadlevels

Hope it can help you :)

Comment
Add comment · Show 14 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mercedgonzalez259 · Dec 12, 2017 at 05:23 AM 0
Share

how would I put this in a script tho. Sorry I'm new to coding.

avatar image PersianKiller mercedgonzalez259 · Dec 12, 2017 at 05:45 AM 1
Share

as @Paul$$anonymous$$evin said you can use playerPrefs .it saves your data in registery I think :).

for example it's your score system

 public int Score;
 public void addScore(int score){
 Score+=score;
 playerPrefs.setInt("SCORE",Score);//so it will save SCORE in registery I guess :)
 }

and how to use it again

in main menu

 public int score;
 void Start(){
 score=playerPrefs.getInt("SCORE");//it will put the value of SCORE in score.
 }


avatar image mercedgonzalez259 PersianKiller · Dec 12, 2017 at 04:45 PM 0
Share

I made 2 scripts of both of theses but they both say they have errors on the playerprefs. is like a variable names? what is it?

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

84 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

One scene, many levels?? 2 Answers

Points system for unity 1 Answer

Is there another way of counting Scores (points) instead of Colliding (destroying) ?? 1 Answer

Fade In each level 1 Answer

Add Score for every Object inside a Box 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges