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 chris 5 · Dec 09, 2010 at 06:54 PM · dynamicbatching

Dynamic Batching Not Working

I have a scene with 5 enemies and my main player. The 5 enemies have the same material, way under 300 vertices/tris each, but are not being batched. I created a test scene that only had the 5 enemies in the scene, nothing else, and they do get batched. I removed all code that moves/rotates the enemies thinking maybe that was creating a new instance of the material, but that did not help. What am I missing?

Also, My scene stats say that 5 objects are being batched when the 5 enemies are just off the left edge of the scene view. I also tested this by moving 2 of the enemies further to the right, then moving my player so that those 2 were just off the left edge of the screen. Now the stat window says 2 objects are being batched! Is dynamic batching related to the camera position? and why aren't they being batched when they are in view?

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 chris 5 · Dec 21, 2010 at 06:15 PM

Figured this out: When I do my sprite animations I was modifying the enemies' renderer.material. This creates a new instance of the material, thus breaking the batching. I changed it to renderer.sharedMaterial and they batched! The only problem is that now all of the enemies have the same animation. However I think I can make this work for my game.

Comment
Add comment · Show 2 · 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 equalsequals · Jan 12, 2011 at 04:10 PM 0
Share

You shouldn't be forced to have every sprite be playing the exact same frame. Are you changing the material each frame of the animation?

avatar image Matt 15 · Jan 17, 2011 at 04:38 AM 0
Share

is there a way to shift the offset of an objects texture without causing another draw call? i thought if they all shared the same material, and texture atlas, that the entire texture would be batched, and you'd be free to move around it to update the objects texture? is this not the case? currently, i have 120 cubes all with 16 possible offsets set using, // thisTransform.renderer.material.SetTextureOffset ("_$$anonymous$$ainTex", Vector2(.75, 0));//example of one of the 16 offset possibilities. //and I get one draw call for each cube, even if it's at the same offset! you'd think they'd share.

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

No one has followed this question yet.

Related Questions

Dynamic Batching again using pool. 0 Answers

Point lights break dynamic batching even when using Unlit 1 Answer

Does dynamic batching and vertex shader work together? 1 Answer

Why isn't dynamic batching working? 3 Answers

Need theory advice on dynamic batching versus combining meshes. 0 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