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 Urist McDrawf · Sep 06, 2010 at 10:50 PM · instantiatecolliderterrainfps

Terrain with lots of objects

Hi, very new user ( only two days :) ) and being bugged with an issue.

I've got a standard Terrain, and I've been populating it with prefabs programmatically ( spelling corrected ;) thanks ! ) using Instantiate. The object is being created in a loop at random positions across the terrain, each one a sphere with 'is trigger' set to yes ( no physics ) and cast/receive shadows off.

This is fine with 25 spheres, but around a 1000 I take a real FPS hit ( using the fps detector from the wiki ). View is kept close, and fog is on, rarely are two or more spheres are visiable to the player.

Now, I plan to have a lot more than a 1000 :) so trying to head off this issue early. I don't want the spheres to do anything. My player will run into the spheres to collect them, therefore all the processing the player object does. The spheres just sit there being lazy, while the player does all the work ( collision detection is in my player game entity in OnTriggerEnter event ).

So, my question is, am I approaching this in the correct way? or is there an easier way of doing things rather than having thousands of spheres lagging my fps? Any comments/suggestions very very welcome :)

Edit : Stats :

As for the stats, the draw calls are in the 50-60s while moving, and fps has dropped so much ( this is with current build with only 400 spheres ). I'm guessing I'm doing something very wrong here :) When at rest, fps is fine, the moving is unplayable. Other stats that might be helpful :

Draw Calls: 50-60 Tris : 43.9k Verts : 24.5k Used Textures : 6 - 2.0 MB VRAM usage : 8.3 MB to 11.2 MB (of 0.5 GB) VBO Total : 152 - 0.9MB

If I comment out the Instantiate call for the spheres, draw calls fall to a constant 7, and there is no lag whatsoever. So its definately the spheres causing the problems.

Edit : Additional Info

Note : My camera is angled so it is top down, so Terrian blocks all view, and can't look up at the sky.

Placing all the spheres below the terrian, shoots up the draw calls to 433, tris, verts vram and vbo also shoots up. Still high frame rate while stopped, moving is reduced to a crawl.

Placing all the spheres above the terrian (and above camera) reduces draw calls to 7, tris to 3.4k, verts to 2.0k, Frame rate fine when still, dropping to a crawl on movement.

Removing the spheres altogether, and movement is fine and same fps as staying still. I really can't work out where the bottleneck is :S

Comment
Add comment · Show 10
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 Jason_DB · Sep 06, 2010 at 11:13 PM 0
Share

"programmatically" :)

avatar image Urist McDrawf · Sep 06, 2010 at 11:18 PM 0
Share

thanks :) changed it :)

avatar image Jason_DB · Sep 07, 2010 at 12:11 AM 0
Share

Also, have you checked the number of draw calls in the scene? If you don't know how to - just click on "stats" in the top right corner of the game window. It's possible that Unity is rendering more than you think you would be able to see.

avatar image qJake · Sep 07, 2010 at 12:23 AM 0
Share

You're still wrong XD It's "Programatically", one 'm', not two. ;)

avatar image Urist McDrawf · Sep 07, 2010 at 07:45 AM 0
Share

That is what it was to start with :) see, this is why I have such problems with it :) And thanks for the stats screen info, even though I had seen it in tutorials and screenshots, it never clicked that I could click on the stats button :) Will updated question with results from stats :)

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by JiffyJuff · May 18, 2013 at 07:09 AM

If the scripts are in the spheres, it's bad. I had a similar game, and in the end I reprogrammed everything so that the player object is the only thing with script. This will reduce the lag a lot. However, this doesn't completely solve the problem as as long as the objects exist, they take up space. I also don't know how to solve this.

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

1 Person is following this question.

avatar image

Related Questions

Terrain collider is inversed! 0 Answers

instantiating water at runtime?? 1 Answer

Detect on instantiate if object is instantiated in terrain 1 Answer

Generated Terrain not colliding! HALP. 0 Answers

The name 'Joystick' does not denote a valid type ('not found') 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