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 BrandonD · May 29, 2013 at 09:47 PM · instantiateframeratedraw calls

Performance issues with grid based terrain

Hello! I'm making a turn based strategy game with a grid-style combat arena (think Final Fantasy Tactics/Civilization). Each arena is a grid of cubes, which can vary in size from 8x8x3 to 40x40x3. This works fine up to about 20x20x3, where I notice some significant frame drops. Some comparisons are below;

 10x10x1 - ~80fps   5.6k  Tris    12k    Verts   1000  Draw Calls
 20x20x1 - ~55fps   22.4k Tris    50.4k  Verts   4000  Draw Calls
 30x30x1 - ~26fps   50.4k Tris    113.4k Verts   9000  Draw Calls
 40x40x1 - ~15fps   89.6k Tris    201.6k Verts   16000 Draw Calls

Using just a simple base. All blocks use the same five materials (One for the top, one for the bottom, one for the four sides near the top, one for the four sides in the middle, and one for the four sides towards the top). In the actual game, I plan on there being many more materials being capable of being used, this is just for the above performance test.

I'm aware of texture batching, but haven't been able to get it to work. My levels are instantiated from code, so this may be the cause. If it's not possible to get texture batching to work in that circumstance, I can look into other options.

Here is the primary code I am using to instantiate the base of the level;

 function MakeBase()
 {
     for(var j=0;j<boardSize.x;j++)
     {
         for (var k=0;k<boardSize.y;k++)
         {
             var block = Instantiate(boardPiecePrefab, Vector3(j,-1,k), Quaternion.identity);
             floorPieces[j][k][0] = block as Transform;
         }
     }
 }

If anyone has any suggestions on how I can improve performance or get texture batching to work properly, I would be very appreciative.

Thanks, Brandon

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by hiddenspring81 · May 29, 2013 at 10:09 PM

To reduce the number of draw calls, you're going to need static batching. Static batching is an optimization that is applied in the Editor. If you instantiate the environment at run-time, you'll loose static batching on those objects. Additionally, if you modify the object by swapping or otherwise modifying any property of the object's materials, you'll also loose static batching.

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 jayhatmaker · May 30, 2013 at 02:30 AM

IMO, you really shouldn't use cubes.
Instead, you should create "cube looking" mesh instead.
(think of mine craft, having millions of "cubes")

I'm working on a project which uses that type of world generation, and with that system, 40x40x3 should be like 4 draw calls. (say 10x10x3 being one chunk)

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

15 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

Related Questions

How to improve performance with a lot of same prefab? 2 Answers

unity locks up when loading prefabs 1 Answer

Retina specific framerate drop on specific function 1 Answer

Performance/framerate issue 0 Answers

Optimizing my draw calls without success 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