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
1
Question by Eldh · Jan 17, 2014 at 03:41 PM · 2dspritescombinecombinemeshescombinechildren

combining littles sprites into one big sprite ?

Working on creating a 2d lvl procedurally i instantiate a lot of sprite of size 32*32. And i was wondering if it's possible to combine all the sprites next to each other (wich are the same into one) ? if it's relevant to save ressources or if it's unecessary ?

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

Answer by jorjdboss · Jan 18, 2014 at 11:31 AM

Yes if you have hundreds of sprites which all have different materials(and/or textures) then the performance hit will be big on mobile.

Unity does Dynamic batching for you where it sends batches of meshes to render. It collects several meshes until it reaches about 900 verts in total and batch it to 1 draw call. So it would batch 225 sprites in 1 draw call, on condition they use the same material.

If you're using Unity 4.3 or above, you can import a sprite sheet from texture packer and make unity recognise it as as sprite sheet by selecting 'multiple' in the import settings. The instantiated sprites are automatically batched at runtime.

Also make sure you don't use Instantiate too frequently, consider using an object recycler if possible.

Comment
Add comment · Show 8 · 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 Eldh · Jan 18, 2014 at 12:47 PM 0
Share

Ups i didn't specify a lot of things. The targeted platform is PC, and i instantiate only on the first load to create the lvl (terraria like)So i'll have thousand and thousand sprites of 32*32. And i'm using the spriteSheet. Is there a limit of drawcalls we can have ? What is the best number to keep the drawcall under ?

avatar image jorjdboss · Jan 20, 2014 at 06:19 AM 0
Share

$$anonymous$$ost modern PCs, even with integrated graphics can handle thousands of draw calls depending on what other workload the gpu handles, such as deferred lighting, texture filtering and antialiasing. So if you don't do much of the latter, then your draw call limit can be high.

Take a look at this forum thread . Its a bit old but will give you a clearer picture of PC graphics optimisation.

If you want to target low end PCs like netbooks, like I said in my answer, batch the draw calls as much as you can.

Check out this $$anonymous$$esh$$anonymous$$erger script. $$anonymous$$ight be helpful to you. Apart from that, like I said in my answer, use spritesheets to reduce the number of materials used and hence the draw calls.

avatar image Eldh · Jan 20, 2014 at 10:20 AM 0
Share

Thanks for the answer. I was wondering is there a relation between drawcall and frame per seconds ? Because when i increase the number of object in my scene ( actually chunk wich contains the sprite tiles, so i'll have hundreds thousand sprites in my scene), the drawcall stay pretty low but my FPS decrease drastically, i end up getting 2 FPS. Is that due to the number of objects in the scene, even if they are not render by the camera ? How can you prevent this ?

avatar image vadurshan Eldh · Dec 08, 2017 at 10:26 AM 0
Share

I have the same issue. If you had found a solution to issue you've mentioned can you help me out on how to solve the issue. Huge number of sprites are created when a user gives a input. The sprites are dynamic sprite. So when the count increases the batch remains low but the fps reduces from 200 to 10. Any kind of help would be appreciated.

avatar image jorjdboss · Jan 20, 2014 at 10:43 AM 0
Share

Do you have a script attached to each sprite with any update loops? Even if you have say, 50 sprites and each of them doing expensive code every frame, then its gonna run slow. There are a multitude of other reasons why the FPS is low. If you have the pro version(or the trial) you may want to run the profiler and identify whats causing the bogdown.

avatar image Eldh · Jan 20, 2014 at 10:51 AM 0
Share

I don't have the pro version. And i don't have script attach to the sprites. I just create a class DataSprite for each sprites at the beginning to access them and tell them what i want, that's it. All the codes are launched at the begining to create the world, the chunks and the sprites. But no more code is running after that for the moment. (if i didn't made an error, but i don't think so)

Show more comments

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

20 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

Related Questions

How to combine sprites and make 1 collider for them 1 Answer

How to swap sprites? 1 Answer

Circular 9 slice? Draw a circle with constant thickness 1 Answer

Why is my sprite not the original resolution? 2 Answers

Having trouble changing sprites in 2 dimensional animation 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