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 RayJr · Oct 14, 2014 at 08:30 PM · gameobjectdesignbest practice

Design Best Practice Question

Hi, In my 2D game, the player can have one of many different robot followers. Each Robot will have a variety of diferent abilities and exist as separate gameOjects currently. Right now, I have about 10 different potential followers.

Question: If I want my player to be able to choose one of these robots to follow them, do I need to include ALL 10 game objects in the scene, and activate only the one that was selected? Or can I dynamically add only one to the scene after the player selects it.

Question Part 2: Are there performance issues related to have many elaborate inactive gameobjects attached to a scene? Is it ok to add any number of gameojects, so long as they are not active, performance will not be impeded.

Thanks!

Comment
Add comment · Show 2
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 Kiwasi · Oct 15, 2014 at 03:10 AM 1
Share

Please note that open ended design questions like this are better suited for the forums.

Try to limit questions on UA to a single specific technical question.

avatar image RayJr · Oct 15, 2014 at 09:23 PM 0
Share

Noted

1 Reply

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

Answer by Fmressel · Oct 15, 2014 at 01:33 AM

If all the robots are active during the choosing stage and they all have scripts that do lots of updates every frame, then yes I think that would have an impact on your performance.

As for performance issues while they are inactive, I found this article:
http://answers.unity3d.com/questions/462942/does-inactive-objects-eat-up-performance.html

And for how I would deal with this issue:
I would have a script that just turns off all the scripts that are not needed on the robots during the choosing stage.

Then once the choosing stage is over; destroy all the robots that the player has not chosen and activate the needed scripts on the chosen robot.

If you need to go through the choosing stage more than once without reloading the level (ie: the choosing stage is in the same level file as the gameplay stage) and you are worried about performance, I would not just destroy the robots but use object pooling instead.

Hope that helps! Let me know if I did not answer your question correctly or you need more explanation!

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 RayJr · Oct 15, 2014 at 02:38 AM 0
Share

That's very helpful Thanks! I will try this for sure. Thanks again

avatar image Fmressel · Oct 15, 2014 at 02:50 AM 0
Share

Great! Glad I could help! :)

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

Very weird dark level loading? 4 Answers

Design approach opinion needed on tilemap vs gameobject 0 Answers

Best practice : Image.enable vs go.SetAactive() 1 Answer

using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers

How to structure code for squad selection and movement 0 Answers


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