diff --git a/Unity3D/ugui/UnityNode.cs b/Unity3D/ugui/UnityNode.cs index c9ba1b6..810eeb8 100644 --- a/Unity3D/ugui/UnityNode.cs +++ b/Unity3D/ugui/UnityNode.cs @@ -464,9 +464,9 @@ private string GetImageSourceTexture() } Renderer render = gameObject.GetComponent(); - if (renderer != null && renderer.material != null) + if (render != null && render.material != null && render.material.HasProperty("_Color")) { - return renderer.material.color.ToString(); + return render.material.color.ToString(); } return null; diff --git a/Unity3D/uguiWithTMPro/UnityNode.cs b/Unity3D/uguiWithTMPro/UnityNode.cs index 94b9652..07ac01e 100644 --- a/Unity3D/uguiWithTMPro/UnityNode.cs +++ b/Unity3D/uguiWithTMPro/UnityNode.cs @@ -464,9 +464,9 @@ private string GetImageSourceTexture() } Renderer render = gameObject.GetComponent(); - if (renderer != null && renderer.material != null) + if (render != null && render.material != null && render.material.HasProperty("_Color")) { - return renderer.material.color.ToString(); + return render.material.color.ToString(); } return null;