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 eganwall · Feb 24, 2017 at 09:48 AM · instantiatespaceshootertop-downenemy damage

Scrolling space shooter - making enemies drop currency

Hello! I'm currently working on a top-down scrolling space shooter, using the Space Shooter Unity tutorial series as a basis. I've got various enemy and weapon types and a way to spawn enemy waves, but the next thing on my list is for enemies to drop several small scraps of metal (which will be used as currency for upgrades) when they die. I really love the feel of Bloons Super Monkey 2, and would like this aspect of the gameplay to evoke that. If you've never played BSM before, here's a screenshot:

BSM2 Screenshot

The small red circles are currency that popped bloons will drop that the player can pick up - each bloon drops several red orbs (probably somewhere around 5-10), which fall towards the bottom of the screen and are sucked up by the player when they get within a certain radius.

Is this best accomplished by having each piece of currency as its own GameObject, and instantiating them in a clump with some kind of artificial gravity that causes them to fall towards the player? Or is there a more efficient way to accomplish this?

Thanks!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by hrgchris · Feb 24, 2017 at 12:36 PM

Hi egan

Making each one its own GameObject is a perfectly valid way to start. If it turns out too slow then you'll need to optimize it!

Probably the big cost will be instantiating lots of coins. The general solution to this is pooling, in which you instantiate a load of bits of currency up front (when the game starts) and disable them all. Then when you need one, you simply position/enable it. Rather than destroying them, you disable and return to the pool.

There's a lot of tutorials on pooling, but I found this one Unity wrote themselves so might be worth a look: https://unity3d.com/learn/tutorials/topics/scripting/object-pooling

-Chris

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

6 People are following this question.

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

Related Questions

Shooting Lasers 3 Answers

Instantiate gameobject on random position on 1. a graph and 2. another gameobject 0 Answers

Project: Space Shooter - GUIText vs UI/Text in Unit3D 4.6 1 Answer

Shooting a projectile with Unet 0 Answers

"AI"/Behaviour for a Waypoint system 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