Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print meaningful object graph for Unity components #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Nezz
Copy link
Member

@Nezz Nezz commented Jan 22, 2025

The object graph used to be just a one-liner in many cases:

SomeComponent

Now when prefabs are being validated, it will look like this:

SomeComponent
Parent
NameOfPrefab (prefab)

This makes it clear which component in which prefab failed the validation, which is especially useful for reusable components.

if (transform.name.EndsWith("(Clone)"))
{
// Stop printing when we find an instantiated object, we are validating that prefab
result.AppendLine(transform.name.Replace("(Clone)", " (prefab)"));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this will work with WithGameObjectName (it would overwrite the default name with "(Clone)"), but I guess it's not very critical.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it'd print the whole hierarchy all the way to SceneContext but I think that's okay.

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.

2 participants