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 MBoffin · Dec 17, 2014 at 12:41 PM · rendererperformance optimization

How much do I need to optimize off-screen objects?

I'm making a basic 2D top-down space shooter. There's a map you fly around and there are lots of things that are off-screen (asteroids, enemies, bases, etc.). Is it enough to just disable the renderer for these objects while they're off-screen? Is there more I should be doing to optimize for performance?

Comment
Add comment · Show 1
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 MD_Reptile · Dec 17, 2014 at 11:10 PM 0
Share

Unless you have hundreds or thousands of objects off screen, then you might be doing early optimization unnecessarily. Have you profiled the game to decide if it's really a slowdown?

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Baste · Dec 18, 2014 at 11:22 AM

Unity uses something that's called frustrum culling, which basically prevents stuff outside of the screen from being drawn. This is also included in the free version.

So disabling the renderer on objects that are outside the viewport should do exactly nothing. You can check for yourself, just put some large textures outside the screen, turn their renderer on and off, and take a look at your fps. There will probably be no difference.

Now, if you've got an entire world outside your view, you might not want to have all of it loaded at the same time. If it's just a big scene, and you're not doing crazy pathfinding algorithms every frame for every ship, you'll probably be fine keeping everything in at the same time.

If you're getting bad performance, you might want to look into some kind of object pooling system. BUT! Never do object pooling before you've actually identified that your game is running slowly, and understand why that's happening.

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 Qasem2014 · Dec 17, 2014 at 10:07 PM

i think you need create a prefab for them and create them in game disable the renderer not help . even disable the gameobject not help too you need create enemy and destroy them with destroy() function

Comment
Add comment · Show 4 · 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 MrSoad · Dec 17, 2014 at 11:06 PM 0
Share

Destroy and Instantiate are not good for performance...

avatar image Qasem2014 · Dec 18, 2014 at 11:05 AM 0
Share

WHAT ? U wana keep all objects in memory ? is that good for performance ?

avatar image MrSoad · Dec 18, 2014 at 12:42 PM 0
Share

No I was thinking of object pooling like @Baste says, with a simple 2D marker movement system for the objects that are not visible, which are then replaced by real objects from the pool when they are close to being in view. It depends on the target platform and also as @Baste says identifying why you game is running slowly before you do anything, inc telling someone to do what you have told them to do here. On a mobile device(or an old laptop) with many objects Instantiate and Destroy can completely kill the frame rate...

avatar image Qasem2014 · Dec 18, 2014 at 05:39 PM 0
Share

YEAH . "culling" option should be your answer . i completly forgot about it :)

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

7 People are following this question.

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

Related Questions

Update Renderer Bounding Volumes - Lower Game Performance 1 Answer

Changing two different objects renderer colour 1 Answer

Make a stand alone exe file with no graphic 1 Answer

Drop on fps while disabling/enabling too many renderers at once (2D) 0 Answers

Perfermance improvement when updating hundreds of thousands particles (objects) at runtime 3 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