Prewarm function

Avatar
  • updated

Hello I'm using shapes (it's amazing) and I wonder if a prewarm function exists ?
Because the first time my line is renderer I got a huge lag spike.
 

Image 732

Thank you !

Reporting a bug? please specify Unity version:
2021.3.5f1
Reporting a bug? please specify Shapes version:
4.2.1
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Avatar
Leo Hilbert

Had the same issue and MoDDiB's prewarm approach works for me as well :)
Would be great to have a "Prewarm" or "Init" Method we can call, since ShapesMaterialUtils is not public, so I needed to adjust the plugin code

Avatar
MoDDiB

Hey thank you for you answer I will try it but as far as I understand I think it's the static ctor of the ShapesMaterialUtils class that cause this spike because all of these ShapesMaterials instanciation :

Image 734

Just a call to a public class that call an empty Prewarm function 

Image 735

is enough to get a proper prewarm and avoid the spike.

Avatar
Freya Holmér creator