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 schwertfisch · Jan 24, 2011 at 03:57 PM · cameraprefabactivatedeactivatepool

Activating & Deactivating prefabs from a prefab pool VS simply moving them on and off-camera (iOS)

I use a prefab pool, instead of instantiating and destroying prefabs of collectibles that get spawned in my game and collected (hence removed from view). The game is for iOS.

The prefabs pool is a group of prefabs that are off-camera and deactivated when the level is loaded.

Whenever a prefab is supposed to get spawned somewhere on the board, it gets activated, moved instantly on board (and on-camera). When my character collects it, it gets instantly moved off-camera and deactivated.

My pool consists of 50 prefabs (that's the maximum potential number of prefabs that might be used simultaneously on-camera).

Is there any use in my having them initially deactivated and activating-deactivating them as described above? Would having them activated all the time and just moving them on and off camera make any difference?

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
1
Best Answer

Answer by Jessy · Jan 24, 2011 at 05:02 PM

Activating is not a fast operation; you don't want to do that. You could move them, or you could just disable their components. You could also add event listeners only at the appropriate times.

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 schwertfisch · Jan 24, 2011 at 06:00 PM 0
Share

Thanks Jessy, but could you please be more specific? So moving the collectibles out of the viewable area when it has been collected, without deactivating it (using "gameObject.active = false;") is not using more resources (than if I had also deactivated it)? What component would it make sense deactivating (in order to spare resources I mean)? For example the collectible's "$$anonymous$$esh Renderer"?. I'll look into using event listeners as I don't yet know what they are.

avatar image Jessy · Jan 24, 2011 at 06:16 PM 0
Share

Right, moving a game object is no big deal unless it has a static collider - use kinematic rigidbodies if you need to move things with colliders. Disabling renderers is the most obvious, but it depends on your game, what you need to do. Unfortunately, I don't know that there are any tutorials showing you how to integrates events into Unity; I never see anyone else using them, but of course most of the code on these community sites is just snippets, not reflecting an interwoven scripting system. Here is a small example, anyway: http://answers.unity3d.com/questions/34045

avatar image schwertfisch · Jan 24, 2011 at 07:43 PM 0
Share

This was really helpful :)

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

No one has followed this question yet.

Related Questions

Using a pool of objects that will be spawned ONCAMERA and removed OFFCAMERA instead of INSTANTIATE & DESTROY (iOS) 1 Answer

How To Disable A Prefab? 2 Answers

Most effective way to get deactivated children? 1 Answer

How to make camera position relative to a specific target. 1 Answer

UI doesn`t render if camera is moved by 1000 units 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