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 leonalchemist · Nov 27, 2014 at 10:17 PM · pooling

[Solved]Pooling activate lag spike

I'm using advanced pooling system free plugins for unity which seem simple but basically doing a 'unlimited runner' where i pool sections with traps ad such in a prefab, seems it the pooling system works fine, but for some reason im getting big lag spike when enabled a section even with a few objects inside maybe 200verts each only, lag can be up to a seconds on mobile but still noticeable on pc which shouldnt be there, not using unity pro*

 poolingSystem.InstantiateAPS(pipeToSpawn.name);

even if i manually enable a section in game there's also lag so any ideas why this would occur for, not many models, low verts, on a good pc, basic shaders(only 25 draw calls in that area) :/ also disabled all script that might have cause problems

[Edit] :/ just realized i've been getting this error

NullReferenceException: Object reference not set to an instance of an object PoolingSystem.InstantiateAPS (System.String itemType, Vector3 itemPosition, Quaternion itemRotation) (at Assets/Plugins/PoolingSystem.cs:111) Player.Update () (at Assets/GalacticCollector/Scripts/Player.js:174)

thats my full spawn bit:

 var pipeToSpawn : GameObject = pipe[(Random.Range(0,pipe.Length))];
 pipeSpawner = poolingSystem.InstantiateAPS(pipeToSpawn.name, Vector3(0,0,pipePosition+50), Quaternion.identity);
 pipePosition += 400;


Comment
Add comment · Show 4
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 Kiwasi · Nov 27, 2014 at 11:26 PM 0
Share

The null reference error will definitely cause a lag spike. Errors are slow due to taking a stack trace.

avatar image leonalchemist · Nov 28, 2014 at 12:11 AM 0
Share

yea i know, just fixed it though, had to send gameObject as well for some reason, and also big lag spike from using mesh collider on a 200 vertsices model? so just changed to box collider, less accurate but works alright

avatar image Kiwasi · Nov 28, 2014 at 04:12 AM 0
Share

Did your mesh collider have a rigid body? $$anonymous$$oving colliders without a rigid body can be expensive.

avatar image leonalchemist · Nov 28, 2014 at 05:40 AM 0
Share

nope, no rigidbodies, dont u mean with its expensive with rigidbodies?

1 Reply

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

Answer by Kiwasi · Nov 28, 2014 at 06:06 AM

No. The physics engine assumes colliders without a rigid body never move. It does some batching that makes them faster. But when you move them the whole batching has to be redone.

Try adding a rigid body set to kinematic and see what happens.

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 leonalchemist · Nov 28, 2014 at 03:55 PM 0
Share

interesting, seems ok, so ur saying anything with a collider that moves around should have a kinematic rigidbody on it, and static objects dont need it. Same goes with box colliders i assume?

avatar image Kiwasi · Nov 28, 2014 at 07:05 PM 0
Share

Applies for any colliders of any type that move

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

27 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 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

Grabbing an object from array 0 Answers

Object pooling - SetActive not working 0 Answers

Setting transform.position makes object appear in wrong place sometimes. Possible conflict with colliders/rigidbody? 0 Answers

PoolObject getting always random prefabs 1 Answer

DontDestroyOnLoad vs Hideflags.DontSave 1 Answer


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