Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 9uile · Jan 20, 2020 at 11:10 AM · bulletspool

Enemies shoot Bullet(pooled)

Hello, In a shmup, I have an enemy shooting bullets. (good start ! :) ) This bullet is pooled and useable by several enemies. Now i want another bullets but i don't know the best solution :

  1. create another bullet with another go pooler or

  2. add another sprite in the current go bullet and then activate the desired sprite when the bullet is active. So in this case, no need to create another pooler ?

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
0

Answer by antonsem · Jan 20, 2020 at 11:40 AM

Having multiple pools won't hurt. But if the question is about the performance, usually the answer is to try the easiest solution, and think about the optimization if there is a problem. Premature optimization is the mother of all evil! :D

Usually, I'm using this implementation myself: https://www.anton.website/resource-manager-and-object-pooling/

This implementation uses different pools for different prefabs. One thing to keep in mind is that all of the referenced prefabs will be loaded to memory as soon as the scene with the ResourceManager is loaded. It might be a problem if prefabs are big.

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 9uile · Jan 20, 2020 at 12:11 PM

This is and interesting way to manage pools ! Thank you. What do you think about my idea to deal with bullets ? Different aspect (sprites) but using the same bullet prefab ? - Add another sprite in the current go bullet and then activate the desired sprite when the bullet is active

if it works, i can only have one bullet prefab for multiples bullet aspect. e.g. having only 1 bullet prefab (with 5 sprites) and 1 pooler instead of 5 bullet prefabs and 5 pools.

And another question :) : I a bullet is only use by one gameobject (a boss), is it good to make the objpool a child of the boss ?

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 antonsem · Jan 20, 2020 at 12:15 PM 0
Share

Since we are talking about very small prefabs (I mean hopefully your bullet prefabs are small :D) it won't matter from the performance point of view. I would prefer to have multiple prefab variants of a base bullet prefab, ins$$anonymous$$d of trying to change it from code. It will keep the code simpler.

avatar image 9uile · Jan 25, 2020 at 05:10 PM 0
Share

I found an interresting tutorial about pooling objects here. https://www.raywenderlich.com/847-object-pooling-in-unity

very useful

avatar image
0

Answer by Stewarrt · Feb 17, 2020 at 08:59 AM

Setting up the shooting, and the ownership of the bullets that are created, is really what this blog is about. When the bullet is created, a few variables need to be updated, such as the owner and the direction the bullet is moving myprepaidcenter

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

121 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 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 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 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 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 avatar image

Related Questions

how to have bullets produce particles? 2 Answers

RayCast Shooting And Errors 1 Answer

How to detect which player shot the bullet? 1 Answer

Firing different bullets 2 Answers

bullets flying through enemy 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