NullReferenceException from ShapeGroup on entering play mode in 2019.4.10f1 LTS with URP

  • updated
  • Fixed

I'm getting the following NullReferenceException whenever I enter play mode with a shape that is tinted by a ShapeGroup:

NullReferenceException: Object reference not set to an instance of an object

Shapes.ShapeRenderer.UpdateMaterial () (at Assets/Shapes/Scripts/Runtime/Components/ShapeRenderer.cs:286)

Shapes.ShapeRenderer.UpdateAllMaterialProperties () (at Assets/Shapes/Scripts/Runtime/Components/ShapeRenderer.cs:363)

Shapes.ShapeGroup.UpdateChildShapes () (at Assets/Shapes/Scripts/Runtime/Components/ShapeGroup.cs:46)

Shapes.ShapeGroup.OnValidate () (at Assets/Shapes/Scripts/Runtime/Components/ShapeGroup.cs:40)

After the exception everything seems to work just fine.

I'm using Unity 2019.4.10f1 LTS and Shapes 2.3.1, this happens in a fresh project.

Also worth noting is that I'm using URP, although I haven't tried this with built-in or HDRP.

Reproduction steps:

-Create new project with Unity 2019.4.10f1 (Universal Render Pipeline Template)

-Import the Shapes package (version 2.3.1), accepting the dialog during import to reload shaders for URP.

-Add a Line object to the scene.

-Add a ShapeGroup onto a new empty game object and parent the Line to it.

-Enter play mode, this triggers the exception.

-The exception is also triggered again upon exiting play mode or reloading the scene.

Reporting a bug? please specify Unity version:
2019.4.10f1
Reporting a bug? please specify Shapes version:
2.3.1
Pinned replies
Freya Holmér
  • Answer
  • Fixed

thanks for the report! this has now been fixed in Shapes 2.3.2

Tom Kail

Hey! Was just about to post this, we're seeing it on 2020.1.4f1.

It blocks us from building too (we've commented it out for now).

Freya Holmér
  • Answer
  • Fixed

thanks for the report! this has now been fixed in Shapes 2.3.2

brycesummer
Quote from Freya Holmér

thanks for the report! this has now been fixed in Shapes 2.3.2

Thank you for the quick fix! Any idea when the new version will go out on the Asset Store?

Freya Holmér

hopefully next week! but no promises as I'm generally pretty busy these two weeks due to teaching my math course