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
0
Question by supericecream · Sep 02, 2014 at 12:16 PM · designhighscores

Script structuring?

I've finished coding a scoring system for my simple game, but I'm wondering how to structure the scoring system itself to make it fit more nicely into the Unity design. Seeing Unity is designed to be bottom-up (Entities owns Logic):

should I have the entities register themselves with a score keeper (another entity), or

should I have a score keeper to keep track all entities?

If it helps, the game is where the player controls a square, and has to avoid dots that are flying everywhere on the screen. Whenever the a dot exit the screen, the score goes up.

EDIT: the dots are spawned by a spawn manager if that helps a bit

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

2 Replies

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

Answer by kacyesp · Sep 02, 2014 at 12:23 PM

If you can do it efficiently, it makes more sense for the score keeper to keep track of the entities. But if it's more efficient for the entities to register themselves with the score keeper, then do it that way.

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 supericecream · Sep 02, 2014 at 12:32 PM 0
Share

Not so much about efficiency, more about confor$$anonymous$$g to coding standards. (I really hate dirty code, and badly designed program structures.)

avatar image kacyesp · Sep 02, 2014 at 12:44 PM 0
Share

If you don't care about efficiency then the score keeper should keep track of the entities, and the entities should not even know the score keeper exists.

avatar image supericecream · Sep 02, 2014 at 12:46 PM 1
Share

Alright, thanks

avatar image
0

Answer by aman_jha · Sep 02, 2014 at 12:26 PM

How are you detecting the dots that exit the screen? I'm assuming you use colliders. On the colliders, attach a script on it that references a script on an empty gameobject. That gameobject should be called the Game Controller. Have a script specific to said GameController. When the collider detects a dot, it should call a function on the GameController which controls the score.

If you need any code feel free to comment on this, just make sure you tell me your language ;)

Comment
Add comment · Show 1 · 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 supericecream · Sep 02, 2014 at 12:29 PM 0
Share

no colliders, i'm just using the main camera view port for this (checking whether the camera can see it still - since the dots spawn in the middle of the screen). I'm using c#.

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

24 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

Related Questions

help with an error cant find no solution 1 Answer

Any recommended books/resources on component-based design? 0 Answers

On Rails (Not StarFox-style, more House of The Dead) 0 Answers

Unity-target mainly for design? 1 Answer

Make unity camera appear all screen width 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