Skip to content

Fix Unity material color dump guard#135

Open
fc470505146 wants to merge 1 commit into
AirtestProject:masterfrom
fc470505146:codex/fix-unity-material-color-dump
Open

Fix Unity material color dump guard#135
fc470505146 wants to merge 1 commit into
AirtestProject:masterfrom
fc470505146:codex/fix-unity-material-color-dump

Conversation

@fc470505146

Copy link
Copy Markdown

Summary

Fix Unity SDK hierarchy dump when a Renderer material does not expose the _Color shader property.

This patch updates both Unity3D/ugui/UnityNode.cs and Unity3D/uguiWithTMPro/UnityNode.cs to:

  • use the local render variable returned by gameObject.GetComponent<Renderer>()
  • guard material.color access with material.HasProperty("_Color")

Root cause

Material.color internally reads the _Color shader property. Some shaders, such as TextMeshPro/Mobile/Distance Field, do not define _Color. During Poco hierarchy dump this can emit Unity errors like:

Material 'LiberationSans SDF Material (Instance)' with Shader 'TextMeshPro/Mobile/Distance Field' doesn't have a color property '_Color'
UnityEngine.Material:get_color ()
Poco.UnityNode:GetImageSourceTexture ()

The current code also creates a local variable named render, but then checks and reads the field renderer instead.

Impact

For materials with _Color, behavior is unchanged. For materials without _Color, Poco now skips the texture/color payload instead of triggering Unity errors while dumping the hierarchy.

Validation

Validated the same change in a Unity 6000.1.12f1 project using Poco Unity SDK and TextMeshPro UI. Before the patch, entering gameplay and dumping UI nodes triggered repeated _Color errors. After the patch, Poco can dump and interact with the UI, and a test GM flow completed successfully:

connected
PlayButton exists: True
SettingButton ready: True
GMForceSuccess: ok
LandedUI exists: True
NextButton exists: True

@fc470505146 fc470505146 marked this pull request as ready for review May 19, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant