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 BongWater · Dec 08, 2015 at 11:59 AM · c#screenmenu2.5dshop

item shop menu screen

Basicly I'm working on a 2.5 d side scroller and I want to create a ui store, for example the main menu would be...

         GAME NAME
              Play
              Store
               Highscore
              Exit


And the store menu would contain different player prefabs for example a xmas themed player, which you can buy with coins earned within the game, stuff you cant afford would be greyed out, a buy and equip button and a main menu/return button, for example

       STORE

  Xamas hat "pic"     100©      equip

Mainmenu.

How would I go about doing this? Where would I begin? I have the main.menu working and a scene with a canvas ready for the store. Thanks in advance

Comment
Add comment · Show 3
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 BongWater · Dec 10, 2015 at 11:02 AM 0
Share

Anyone? I cant seem to find an answer anywhere

avatar image ZefanS · Dec 11, 2015 at 02:46 AM 0
Share

I'm not really sure what your question is. $$anonymous$$ost of the work is just creating the UI for the store, which it seems you know how to do. Other than that, you just need to have some script that tracks things like how much money the player has, whether they have the Christmas hat, etc. and update both the store UI and the player's model, etc. If you can be more specific about what you need help with it would make it easier to come up with a more complete answer. Hope this helps a bit at least though.

avatar image BongWater ZefanS · Dec 11, 2015 at 08:21 AM 0
Share

I can track the total coins the player has, I'm guessing that the buy buttons will check the amount of coins (be greyed out if theres not enough money) and subtract the amount from the coin total. I just dont know how to; equip the hat after buying, or how to script any of this in a simple way(c#) I could try but it'd be a messy script and I belive there is a simple way to script it

1 Reply

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

Answer by ZefanS · Dec 11, 2015 at 08:40 AM

There are numerous ways that you could structure this system, so keep in mind this is only one. I would create it as a modular system using multiple scripts, each with a well-defined task, and maybe some sort of hierarchy. In particular, I'd use:

  • A UI management script that would handle all the UI, including the greying-out and the button clicks

  • An inventory script that persists throughout the game that tracks the player's money and items

  • A lower-level item-equipping script to handle the particulars of changing the player's appearance

The process would work something like this: The inventory script tracks the player's money throughout the game. Once the player enters the store context, the UI management script checks the inventory to get the amount of money, and then generates the store UI appropriately. When the user clicks the "Buy Santa Hat" button, the UI script tells the inventory management script to subtract X amount of dollars and add the Santa Hat to the inventory. The inventory is then aware that the Santa Hat is available to the player, and can tell the item-equipping script to do the work of changing the player's character to include the Santa Hat.

Using separate scripts like this will allow you to keep your code cleaner and approach each type of problem separately. For instance, you can get the entire buying mechanic functioning without having to worry about the code for changing the player's appearance.

As for the nitty-gritty of actually writing the scripts, there's no better way to get improve at it than to practice. If you run into trouble with specifics you can always ask another question, or maybe start a thread on the forum and link it here so there can be some sort of running discussion.

Comment
Add comment · Show 3 · 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 BongWater · Dec 11, 2015 at 05:11 PM 0
Share

Thank you so much for your clear and easy to understand answer this will help me tons! I was going to try and use.one script which would.of.been chaotic, but now I know.where. to start and will give it.a go, again thank you so much for this answer, you've helped me out alot and hopefully others with a similat problem :D

avatar image ZefanS BongWater · Dec 14, 2015 at 12:18 AM 0
Share

You're welcome! I'd appreciate it if you could hit the Accept button to mark this as the best answer.

avatar image BongWater ZefanS · Dec 14, 2015 at 10:06 AM 0
Share

ah didn't know I had to do that, done!

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

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Menu in C# 2 Answers

drop down list c# 1 Answer

How do i make a menu close if i open another menu 1 Answer


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