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 DanielAllison · Aug 16, 2019 at 09:47 AM · renderingbatchingprofilingstatic batchingoptimisation

Static batching not reducing draw calls but is creating batches

I'm seeing this issue in Unity 2017.4.1.

I've been working on a lot of optimisation stuff recently and currently looking at batching. I setup a scene where I'm creating objects at runtime and then adding them to a static batch using the StaticBatchingUtility with the following script:


 private void Start()
 {
        var objList = new List<GameObject>();
 
        //instantiate objects and populate objList
 
       var objArr = objList.ToArray();
       StaticBatchingUtility.Combine(objArr, holder.gameObject);
   }


This produces the following in the memory profiler:

alt text


It looks like the static batches are being created but the draw calls aren't reducing as I would expect. If I remove the static batching code from the script and simply instantiate them and let dynamic batching be applied, the profiler displays the following:

alt text
Here, the batching is working as I would expect. I could go ahead and use dynamic batching but from what I hear static should be working better. In terms of performance, I'm not really seeing a difference between static and dynamic batching here but when I increase the number of objects in the scene, static batching tends to run a bit better. This makes me think that it might just be a big with what the profile displays rather than with the batching itself. Any helps on the issue would really be appreciated.

staticbatching.png (55.2 kB)
dynamicbatching.png (17.0 kB)
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 DanielAllison · Aug 19, 2019 at 02:00 PM 0
Share

Spent some more looking at this and while I've not found a solution, I've narrowed it down a little. The issues seems to be occurring because the meshes being batched have submeshes. I tested the same scenario as above with a simpler mesh without submeshes and it worked fine.

Also confirmed that I'm still seeing the issue in Unity 2019.3.0a6.

avatar image DanielAllison DanielAllison · Aug 21, 2019 at 08:47 AM 0
Share

In case anybody comes across this post while dealing with the same issue, I'll update what I ended up doing. Ended up just using GPU instancing on the materials ins$$anonymous$$d which isn't ideal but definitely hit a wall with progress so it saved me the headache of digging any deeper.


I did find a script that splits submeshes into separate mesh renderers but it didn't really work as I'd have liked it too. It dropped the draw calls but the actual frame rate dropped as well. When I tested this, dynamic batching and Instancing without splitting the renderers up was better than static batching with the split submeshes.

0 Replies

· Add your reply
  • Sort: 

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

129 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

Related Questions

The combined mesh is different between static-batched objects? 0 Answers

Batching problem: Poor forest tiles don't batch [fixed but not sure why xD] 1 Answer

What is the alternative to Material Property Blocks when using SRP Batcher? 0 Answers

Why does the frame debugger say node uses different shader when it isn't? 0 Answers

When Static Batching and building, objects checked Static do not appear 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