Shapes triggers dirtying of Prefabs project-wide due to updating Bounds in OnValidate

Avatar

We've found that the UpdateBounds function that is called within ApplyProperties causes all Prefabs in a project that contain a ShapesRenderer to be dirtied.

The problem we have is that when using Shapes with version control, this causes regular checking out of all Prefabs within a project that contain any ShapesRenderer, since OnValidate is called on domain reload for MonoBehaviours with [ExecuteAlways], meaning all of these Prefabs are dirtied, and checked out, with every domain reload.

Since I don't think updating bounds needs to happen at edit time, we have fixed this internally by simply changing the ApplyProperties function to the below:

private protected void ApplyProperties(bool updateBounds = true)
{
    VerifyComponents(); // make sure components exists. rnd can be uninitialized if you modify an object that has never had awake called
    rnd.SetPropertyBlock(Mpb);

    if (updateBounds) UpdateBounds();
}

and then updating the ApplyProperties call within OnValidate to pass false for updateBounds.

Reporting a bug? please specify Unity version:
6000.0.43f1
Reporting a bug? please specify Shapes version:
4.5.0
Reporting a bug? please specify Render Pipeline:
URP