Polyline with world pos points located at origin does not render until you look at the origin

Avatar
  • updated
  • Under Review

I'm generating polylines dynamically at runtime to visualize paths of units in my Kingdom Management Game.

I create a gameobject at 0,0,0, add a polyline component, and add world positions to the line that correspond to their path. The line will not render until I look at 0,0,0. Calling UpdateMesh(true) works around the issue.

Reporting a bug? please specify Unity version:
2019.4.3f1
Reporting a bug? please specify Shapes version:
2.0.0
Reporting a bug? please specify Render Pipeline:
Avatar
Freya Holmér creator
  • Under Review

It's designed to only update when it has to, so this is an optimization to save performance when modifying many polylines, to avoid wasteful updates on every modification

Now, the reasoning I had was "before rendering this, check if it's out of date", but, if the bounding box of the previous mesh isn't seen, it doesn't know that it's supposed to be rendered, and the mesh isn't

I guess I could go in either of two ways here:
1. modify the bounds immediately, but not all mesh data (need to make sure the entire mesh doesn't update just because of this)
2. check out of date state in OnPreCull (need to make sure this isn't a big performance hit, since it's always called)