Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 thehippomaster21 · Sep 25, 2017 at 10:11 PM · 2dspritescenescene-loadingspriterenderer

How to efficiently populate scene with GameObjects

I'm creating a 2D scene for the first time and want to make sure I'm setting the scene up properly.

For the background, I have many building assets which are just GameObjects with only SpriteRenderers attached. I also have window, door, etc prefabs that only have SpriteRenderers and a collider. If I add all of these, my scene will end up with 40+ GameObjects.

Am I approaching this the right way? And if not, how can I populate my scene efficiently?

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

Answer by JonPQ · Sep 25, 2017 at 10:17 PM

40 is not a lot of game objects. For 2D there are a few things to (mainly) worry about....

  1. Overdraw... are you re- drawing a large percentage of the screen by layering sprites on top of each other.... avoid this where possible.

  2. transparency, are you using alot of transparent sprites (with alpha channel) ? only use where necessary as alpha is slow... (but bear in mind the size of sprite... alpha on some small sprites doesn't matter alot... but on large areas, it matters more)

  3. Draw calls. open up the statistics button at the top... try to keep your number of draw calls / batches low. ballpark <100 but the lower the better, especially on mobile. You can optimize this by using Sprite sheets (unity can automatically batch them together for you onto the same sheet) look it up in unity docs. Typically you get one or more draw calls per material.

There is a lot of info around on performance, just google it or look in unity docs or forums on previous posts.

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 thehippomaster21 · Sep 25, 2017 at 11:10 PM 0
Share

Appreciate it. And what is considered a reasonable number of draw calls / batches?

avatar image JonPQ thehippomaster21 · Sep 26, 2017 at 03:52 PM 0
Share

Its more about... are you wasting draw calls... there is wasted performance overhead with each draw call.... setting up rendering hardware... Suppose you are drawing 100 zombies, each one is a sprite... they could all be using different animation frames.... and that could be 100 textures => 100 materials. OR is you put the same packing tag name on them all, unity might be able to pack them all onto one sprite sheet. = 1 texture = 1 material. and then it can send them all to the rendering hardware in 1 go (1 batch) :) basically you'll be wanting to organize things to $$anonymous$$imize draw calls, and allow unity to batch more objects together. https://docs.unity3d.com/$$anonymous$$anual/DrawCallBatching.html

avatar image JonPQ JonPQ · Sep 26, 2017 at 03:53 PM 0
Share

couple other tips... make sure backdrop is non transparent.... non lit. set camera to clear z depth only.... no point in clearing backdrop, then putting a backdrop on top also.

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

154 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 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

Weird line on top of a single sprite 0 Answers

How to change sprite only on click or during shoot state? 1 Answer

Texturing custom 2d sprite 0 Answers

How change sprite animation texture?? 2 Answers

Cut holes in sprite using other sprites 2 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