• 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
2
Question by 3Duk · Feb 28, 2013 at 10:36 AM · gameobjectsmax

Max number of Gameobjects (5000?)

I made a simple minecraft clone but I have to delete blocks to instantiate more once I get to roughly 500-800 blocks. Each block has 6 sides (obviously) and one parent object.

Is there a limit for Unity free, or a setting anywhere to change?

Comment
Add comment · Show 19
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 robertbu · Feb 28, 2013 at 10:49 AM 1
Share

I don't know if there is a limit. But if there is, it is high. If I remember correctly I did a Ulam's spiral with my daughter that used around 45,000 game objects. We also did Conway's Game of Life with 10,000. Of course it depends on your platform. 3,000 simple game objects brings an iPad to a crawl (5 FPS).

avatar image 3Duk · Feb 28, 2013 at 11:03 AM 0
Share

conways game of life is super cool

avatar image Tarlius · Feb 28, 2013 at 11:16 AM 0
Share

In case it wasn't obvious, you only need to use a gameobject for the blocks you can access/see. If you cull the others you might be able to go further.

Even then you won't be able to make a very large area though... You'll probably have to manipulate your own mesh or something. If you make a separate mesh for every stack of blocks maybe, it'll be easier to manage, and also you'll be able to remove ones far away to replace with closer ones.

Never heard of this limit though, interesting...

When you say "6 sides" you don't mean a separate game object for each side, I assume?

...Now you've made me want to try making a $$anonymous$$ecraft clone too >.>;;

avatar image Mikilo · Feb 28, 2013 at 11:24 AM 0
Share

Even with culling objects, they are allocated in memory, with or without culling, you have a limit. You are just treating about visual, I think he is speaking about hardware limit.

avatar image Tarlius · Feb 28, 2013 at 11:37 AM 0
Share

That wasn't what I meant. I meant, only allocating the ones you can actually see, although I do appreciate that it was a bit of an abuse of the word "culling" ><

Show more comments

3 Replies

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

Answer by Eric5h5 · Mar 01, 2013 at 01:35 AM

Making every block a separate GameObject is extremely inefficient; the standard way is to create mesh chunks that each contain many blocks. There are plenty of topics about this (even code) you can find if you do a search.

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 Mikilo · Feb 28, 2013 at 10:55 AM

Hi!

I've read somewhere that yes, there is a limit. Someone has tried to generate a grid of tiles of 128*128 GameObject and Unity crashed rightafter. He replaced his GameObject by ScriptableObject and he was able to generate tremendously more. But these types don't have the same purpose.

Here is the link to the post: http://answers.unity3d.com/questions/365552/why-would-you-use-a-scriptable-object-versus-an-em.html

Comment
Add comment · Show 3 · 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 3Duk · Feb 28, 2013 at 11:02 AM 0
Share

thanks didn't know about scriptable object. still lost as to what my problem may be...

avatar image Mikilo · Feb 28, 2013 at 11:05 AM 0
Share

Here is another link to someone who shows a use of ScriptableObject: http://buchhofer.com/2010/10/unity-toying-with-scriptable-objects/

avatar image Unity3DJava · Mar 19, 2013 at 12:27 AM 0
Share

$$anonymous$$aybe you should load your project into scenes to not have that many GameObjects(Less Laggy)

avatar image
0

Answer by GankMeXXX · Mar 04, 2014 at 01:34 AM

the main reason I think why multiple game objects for blocks doesn't work so well is because...

YOU PROBABLY HAVE 1 mesh per game object...

Meshes are terribly more complex then your average class.

  • Stuff I've learned about meshes.

  • A single mesh has a vertex/triangle limit of 65k(I forget which is it actually is since rarely hit the error anymore... I code not to hit it anymore.

  • Sub meshes from what I've read take up as much memory allocation as their parent mesh.(I'm sticking with not using the built in sub meshes.)

  • generating meshes and assigning code run pretty fast but they are long loops that when many are running at the same time will tend to lock up the cpu a bit.(This is where multi-threading helps.)

  • The more meshes you have visible the more draw calls/gpu cycles are used to render the screen.

  • Some shaders greatly improve/deprove the rendering of your meshes. FPS wise and drawcall/gpu cycles

  • Generating Tangents for a mesh at run time can be rather time consuming.(I'm working on speeding this up)

I am thinking about using game objects just for updating data and not rendering.

The correct answer is to use prefab chunk objects. The interaction can get rather complex between the chunks and their parent object.

The parent would have an array of the chunks. [chunkX,chunkY,chunkZ] The parent would also have an array of bytes [x,y,z] bytes would indicate the type of block.

Just about all interactions with the voxel worlds rely on these two data sets to transform your word.

The chunk object then monitors these values and recreates the mesh for the area based on these values.

I think its called "Culling" which is where you determine if specific sides of the "voxel" or cube are visible. And then only create triangles in the mesh for these visible sides.

Then there's marching cubes which is another story....

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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 store, change and delete gameobject and it's list element? 0 Answers

how to let two game objects share the same world coordinations? 0 Answers

Adding GameObject to selected Scene 1 Answer

How do you change size of an object by its units rather than scale? 1 Answer

Bullets follow the ship in 2D Space Shooter game 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