Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GeneratePhysicRepresentationForMesh causing slow down
#2
(09-09-2019, 07:45 AM)BetaJester Wrote: Hi there

I've got a simulation where we create Obi Cloth balloons which move around the screen. However, whenever we spawn a new bubble and use GeneratePhysicRepresentationForMesh we're getting significant slow down. 

For reference we call:  
Code:
yield return balloon.GetComponent<ObiCloth>().GeneratePhysicRepresentationForMesh();
inside the spawn coroutine. 

I've tried threading the code, but GeneratePhysicRepresentationForMesh needs to be on the main thread. Is there a way it is meant to be used which means it has a minimal performance hit? 

- BetaJester

Hi!

GeneratePhysicRepresentationForMesh is a coroutine that returns a completion percentage. As such, at runtime it is supposed to be used together with some sort of "loading bar" or UI feedback. It is a very resource intensive process that can take quite a while to get done.

If you want to create balloons at runtime, best approach is to either have them pre-generated as prefabs, or if you need to use procedural generation, generate one (or several variations) at the beginning of your scene, then instantiate copies of them.
Reply


Messages In This Thread
RE: GeneratePhysicRepresentationForMesh causing slow down - by josemendez - 09-09-2019, 07:52 AM