diff --git a/AGXUnity/Utils/RenderingUtils.cs b/AGXUnity/Utils/RenderingUtils.cs index aa7a97f2..e4983ede 100644 --- a/AGXUnity/Utils/RenderingUtils.cs +++ b/AGXUnity/Utils/RenderingUtils.cs @@ -126,7 +126,18 @@ public static bool CameraShouldRender( Camera cam, GameObject allowedPrefabObjec /// A new material if the current render pipeline is recognized or null otherwise public static Material CreateDefaultMaterial() { - return new Material( Shader.Find( "AGXUnity/Shader Graph/CrossRPDefault" ) ); + var shader = Shader.Find( "AGXUnity/Shader Graph/CrossRPDefault" ); + if ( shader == null ) + { + Debug.LogWarning( "AGXUnity/Shader Graph/CrossRPDefault shader not found. Falling back to Standard shader." ); + shader = Shader.Find( "Standard" ); + } + if ( shader == null ) + { + Debug.LogError( "Failed to find any suitable shader for CreateDefaultMaterial." ); + return null; + } + return new Material( shader ); } ///