Need SpriteShape callbacks for when it is generated, but how?

Hi! I am procedurally generating a racing track (with an automatic linerenderer) and I need to wait for it to finish before I remove a black overlay and allow the player to take control of the car.

The track length differs from run to run so I can’t just wait … I dunno, 5 seconds and assume it is done. Every now and then I start too early and the SpriteShape does not exist.

I snooped around and found Job logic around but the creation starts inside “OnWillRenderObject” and I have no way to access it.

I wish there where some Action or UnityAction as callbacks for when the track is done creating. Or perhaps there’s something with Jobs that I am just not aware? I don’t know but I really could appreciate your help <3

@Discipol You could call SpriteShapeController.BakeMesh() to explicitly submit SpriteShape generator job. It returns the JobHandle.

https://docs.unity3d.com/Packages/com.unity.2d.spriteshape@2.1/api/UnityEngine.U2D.SpriteShapeController.html

This is available both in 2.0.0-preview.8 (2019.1) and 2.1.0-preview.7 (2019.2 and above) versions. What version are you using ?