Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 evrokrem · Jul 08, 2015 at 10:22 AM · unity 5newbiegamesupgrading

How to make an upgrading game?

I just made Roll-a-Ball and Survival Shooter from unity tutorials. So i am still a newbie to Unity. I want to make an upgrading game, where your character does something, like collecting things or shooting enemies to earn points, and then later, uses that points to buy upgrades for himself and be faster, have more health... or something like that. I work in Unity 5.

Comment
Add comment · Show 2
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 evrokrem · Jul 08, 2015 at 10:04 AM 0
Share

$$anonymous$$y question is: How can i spend my points to upgrade a character?

avatar image screenname_taken · Jul 09, 2015 at 07:34 PM 1
Share

Cut your problem in small chunks. You want your character to have points in his health, power, speed etc. So, you'll need to add those as variables in a script. Your points will earn upgrades. That means simply to add more points to those attributes. Then you'll need to save those attributes in a file somehow and read it back when loading the game at a different time. The easiest and probably least correct way is through playerprefs. Least correct way because that should be used for game options and the like as it is easily modifiable from outside the game. You could check about serialization with Unity for save games.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by NeverHopeless · Jul 08, 2015 at 10:40 AM

Your characters must have attributes like speed, health etc. So for example once the user buy some product e.g., energy drink that increases health upto 3% then that variable that controls the health should represent a 3% more value than the original (if it was 100 it will be 103 now) and character sprite can be upgrade too. You can save these parameters using PlayerPrefs class.

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 evrokrem · Jul 09, 2015 at 07:20 PM 0
Share

$$anonymous$$y question is: How can i spend my points to upgrade a character?

avatar image Hexer · Jul 09, 2015 at 08:17 PM 1
Share

Better follow some basic scripting tutorials of C#. As NeverHopeless said you can use PlayerPrefs to save your points that you achieve in the game + save your player stats.

You have to make some variables that defines health, speed etc. like "int health" Then you have a variable that is called "int upgradePoints" then you have a button so you can give "int health" some upgrade points. When you click on it upgradePoints -= 1; and health +=1;.

  if(health == 0){basichealth = 100;}
 if(health == 1){basichealth = 110;}

you have to save health as a playerpref class so that you won't lose your points when the game re-loads.

Also you have to be aware that if(upgradePoints == 0) that you ofcourse can't upgrade your character. How you do it is up to you, maybe disable the collider for that button? It is just a suggestion.

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

Failed to Load Mono? 0 Answers

does unity run in the back ground? 1 Answer

Restart the scene without changing the scoreboard 0 Answers

Disabling and Enabling a collision 1 Answer

Character Controller visibility in Unity 5 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