Skip to content

Migration fails on Unity 7 text assets: %UNITY directive before %YAML is read as binary #1

Open

Description

@dyskom

Product

🔤 UniText

Product version

media.lightside.core 4.4.0, media.lightside.unitext 3.30.0

Unity version

Unity 7000.0.0a7, Windows 11

Platforms

🛠️ Editor

Render pipeline

Not relevant

What happened?

Error:
[LightSide] 85 migration error(s) occurred while updating to media.lightside.core 4.4.0, media.lightside.unitext 3.30.0. ...
System.IO.IOException: [LightSide] Migration coverage is incomplete: 'Assets/.../BootstrapConfig.asset' could not be inspected.
---> System.IO.InvalidDataException: The source has neither a Unity YAML header nor supported native binary metadata (format 774900261).
at LightSide.ProjectYamlFiles.InspectNativeMetadata(...) in Editor/Migration/ProjectYamlFiles.cs:line 183
at LightSide.ProjectYamlFiles.ReadSource(...) in Editor/Migration/ProjectYamlFiles.cs:line 159
at LightSide.MigrationIndex.b__0(ScanTarget target) in Editor/Migration/MigrationIndex.cs:line 443

Cause:
Unity 7 writes a format directive line above the YAML header in text assets.

Suggested fix (I’m running it locally as a patch, and migration then completes):
/// Unity 7 writes a %UNITY format directive on the line before it.
static bool OpensYamlDirective(Stream stream)
{
Span header = stackalloc byte[32];
int read = 0, step;
while (read < header.Length && (step = stream.Read(header.Slice(read))) > 0) read += step;

ReadOnlySpan<byte> text = header.Slice(0, read);
if (read >= 3 && header[0] == 0xEF && header[1] == 0xBB && header[2] == 0xBF) text = text.Slice(3);
if (StartsWith(text, "%UNITY "))
{
    var newline = text.IndexOf((byte)'\n');
    if (newline < 0) return false;
    text = text.Slice(newline + 1);
}
return StartsWith(text, "%YAML");

}

static bool StartsWith(ReadOnlySpan bytes, string ascii)
{
if (bytes.Length < ascii.Length) return false;
for (int i = 0; i < ascii.Length; i++)
if (bytes[i] != ascii[i]) return false;
return true;
}

Steps to reproduce

  1. Try migration on the Unity 7

Logs

Screenshots, video or a minimal project

No response

Before submitting

  • I searched existing issues and this is not a duplicate.
  • I removed access tokens and registry URLs from everything I pasted or attached.

Activity

  1. added theissue type on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔤 UniTextText and document engine🛠️ EditorPlatform where the problem occurs

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions