Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by jacques 1 · Apr 21, 2011 at 02:00 AM · systempointpointscoinscoin

points system with coins

hey guys what is a good script for passing through a coin getting a point, then coin is destroyed, and after so many points getting to a next level/beating the game please help this is one of my final touches but of corse a big part

Comment
Add comment
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

3 Replies

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

Answer by Alex 9 · Apr 21, 2011 at 03:45 AM

Script for the Coin

   function OnTriggerEnter(hit : Collider){
    if(hit.gameObject.tag == "Player"){
    //add a tag to the player called Player, or just
    //replace it with your tag if you already have one
    ScoreSystem.myScore += 1;
    Destroy(gameObject,0.0);
  }
}

Attatch this Script anywhere but name the Script "ScoreSystem" (this is very important)

static var myScore = 0; var DelayTime = 10; function Start(){ myScore = 0; Invoke("myFunction", DelayTime); }

function OnGUI(){
GUI.Label(Rect((Screen.width / 2) + 20,10, 200, 30), "Score: " + myScore); }

Attatch This Script Anywhere as well

function Update(){
if(ScoreSystem.myScore == 10){ //change the 10 to however many coins there will be
    Application.LoadLevel("YouWon");//Make a scene named "YouWon" and add it to the build
}

I hope this helps. Please review this code and learn from it.

Comment
Add comment · Show 2 · 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 jacques 1 · Apr 21, 2011 at 09:27 PM 0
Share

what do i do? it says trying to Invoke method: ScoreSystem.myFunction couln't be called

avatar image himanshu619 · Dec 08, 2012 at 09:31 AM 0
Share

$$anonymous$$ 9, can you tell that how the score of previous level would be added to next level starting score, Because it seams from your script that it would start with "zero" every-time!

avatar image
0

Answer by prajyoth · Jun 30, 2015 at 04:34 AM

Using playerprefs could solve the problem of coins reloading.

PlayerPrefs.setint("score",myscore); //this will set the coin value

PlayerPrefs.Getint("score"); // this will get the stored coin value

Comment
Add comment · 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
0

Answer by idurvesh · Jun 30, 2015 at 05:07 AM

Soomla has pretty good Scoring system with lots of features icluding social sharing,achievements ,IAP and lot more for FREE, have look at it, http://soom.la/

Comment
Add comment · 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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Problem About Gaining Points 1 Answer

Who can help me with lock/unlock and hint/coin systems? 0 Answers

2D Coins and Points 1 Answer

point system for car game 1 Answer

Points based combat system | help 0 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