Fix Unity material color dump guard#135
Open
fc470505146 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix Unity SDK hierarchy dump when a Renderer material does not expose the
_Colorshader property.This patch updates both
Unity3D/ugui/UnityNode.csandUnity3D/uguiWithTMPro/UnityNode.csto:rendervariable returned bygameObject.GetComponent<Renderer>()material.coloraccess withmaterial.HasProperty("_Color")Root cause
Material.colorinternally reads the_Colorshader property. Some shaders, such asTextMeshPro/Mobile/Distance Field, do not define_Color. During Poco hierarchy dump this can emit Unity errors like:The current code also creates a local variable named
render, but then checks and reads the fieldrendererinstead.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
_Colorerrors. After the patch, Poco can dump and interact with the UI, and a test GM flow completed successfully: