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 xend · Oct 07, 2010 at 08:41 PM · instantiateframerate

unity locks up when loading prefabs

Greetings!

Im pretty new to unity so bare with me if this problem has already be dealt with somehow, but my search did not turn up with much information.

My problem is as follws: I instantiate 32x32x32 Cubes with a script in my scene as soon as its loaded. Now all cubes are the same so i dont think there should be a problem with too many draw calls, but anyhow the performance goes from nearly unbearable to not existent.

Do you know what the problem is?

Beyond is the code im using:

public GameObject prefab; public float gridX = 5; public float gridY = 5; public float gridZ = 5; public float spacing = 2.0F;

public GameObject closeTileDepth;

void Start () { for (var y = 0; y < gridY; y++) { for (var x = 0; x < gridX; x++) { for (var z = 0 - gridZ; z < 0; z++) { var pos = new Vector3(x, z, y) * spacing; GameObject obj = (GameObject)Instantiate(prefab, pos, Quaternion.identity); } } } }

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 Tzan · Oct 08, 2010 at 05:17 PM

When you instantiate 32,768 objects you have that many draw calls if they are all on the screen. You can drop this number by merging meshes that use the same materials. http://unity3d.com/support/documentation/ScriptReference/Mesh.CombineMeshes.html

When running in the Editor did you open the Stats panel? Button at top right of player window. The top line shows draw calls.

The recommended max is around 400-500 in Unity 2.6 on a machine several years old.


Which version of Unity are you using? If you are using Unity 3 there is batching. If it batches everything then the draw calls should be very low.

Discussion about Batching in Unity 3 http://forum.unity3d.com/threads/62714-Batching-HOWTO?highlight=batch But there are a lot of things that break batching.

Comment
Add comment · Show 1 · 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 xend · Oct 11, 2010 at 11:15 AM 0
Share

thank you, that solved my issue... combining the meshes works like a charm :)

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

Instantiate problem for game editor 1 Answer

Lagspike when using instantiate in coorutine 0 Answers

Huge Framerate Drop 0 Answers

Checking if object intersects? 1 Answer

Performance issues with grid based terrain 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