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 TopsyKretts · Oct 10, 2014 at 02:26 PM · 2dgameobjectperformance

Do offscreen gameobjects affect performance?

Hey,

I'm creating a 2D, tilebased, top-down game. My map is randomly generated and should be about 1000x1000 tiles. Now my question is: is it okay to instantiate all tiles at the start of the game, or should I only instantiate those tiles that are on the screen?

Thanks in advance

Cheers

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
1

Answer by dschneider · Dec 16, 2014 at 07:58 PM

I use SpriteTile for randomly generating my world. I started out with 1024x1024 and as far as I can remember it worked fine. SpriteTile doesn't use meshes, it's heavily optimized for this kind of games. However I populate my world with game objects like palms and stones and that pulls down performance. So I ended up dividing my world into different sectors which are game objects themselves. They contain entities and whenever you are not in a sector, the entities are disabled. The sectors are 256x256 now and that works well with AI controlled enemies, game objects etc.

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 robertbu · Oct 10, 2014 at 03:03 PM

1000 x 1000 is 1 million tiles. You are not going to be able to create that number of tiles (or at least I wouldn't be able to on my reasonably high-end desktop system). If the number of tiles visible at one time is small, then you might be able to play some sort of shell game...using a set number of objects and swapping them in and changing their display to represent the 1000 x 1000.

But typically this kind of things for tiles is done by creating each tile as s quad in a mesh. Each mesh can then contain up to 16K of quads. So around 65 game object can represent all 1 million tiles. There is some starter code here if you are interested in this approach:

http://answers.unity3d.com/questions/769358/tile-game-slow-lots-of-sprites-texture-atlas.html

Search Unity Answers for 'voxels' or 'minecraft' for more information representing many game objects using meshes.

Comment
Add comment · Show 1 · 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 TopsyKretts · Oct 10, 2014 at 04:05 PM 0
Share

thanks, I will look into that

avatar image
0

Answer by Eric5h5 · Oct 10, 2014 at 04:22 PM

Assuming you could have 1000x1000 objects (spoiler: nope), off-screen objects do affect performance to some extent because they need to be culled every frame to determine whether they should be drawn or not.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Performance Hit of Adding Many GameObjects? 1 Answer

What faster? Make a saved scene with gameobjects, or create it on start? 1 Answer

2D Side Scroller Background 3 Answers

How to use the scene edit for Line Renderer? 1 Answer

How to create a timer with the new UI text? 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