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

Fix parsing of entries with multi-line object references #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Grimeh
Copy link

@Grimeh Grimeh commented Jun 12, 2024

At some point Unity started breaking inline objects onto multiple lines (presumedly once they reach a certain line length). This causes the parser to incorrectly begin parsing on the variants: line instead of the desired - keywords: line of the first element of the variants array.

This fixes that by detecting when the shader asset reference spans multiple lines (by looking for an increase in indentation) and skips forward an extra line if that is the case.

Example of multi-line inline object reference:

  - first: {fileID: -6465566751694194690, guid: 750e95cd9826dc046a8b87ea0c15919e,
      type: 3}
    second:
      variants:
      - keywords: 
        passType: 8
      - keywords: _ADDITIONAL_LIGHTS
        passType: 13
      - keywords: _ADDITIONAL_LIGHTS _SCREEN_SPACE_OCCLUSION
        passType: 13
      - keywords: _ADDITIONAL_LIGHTS _SCREEN_SPACE_OCCLUSION _SHADOWS_SOFT
        passType: 13

At some point Unity started breaking inline objects onto multiple lines (presumedly once they reach a certain line length). This causes the parser to incorrectly begin parsing on the `variants:` line instead of the desired `- keywords:` line of the first element of the variants array.

This fixes that by detecting when the shader asset reference spans multiple lines (by looking for an increase in indentation) and skips forward an extra line if that is the case.
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