Skip to content

Unity 6 Shader Support #93

@AXiX-official

Description

@AXiX-official

I tried two unity 6 games, PEAK which is unity6000.0.36f1 and StarSavior which is unity6000.0.30f1, shader cant be loaded.

Image Image
// AssetStudio/Classes/Shader.cs (L750-768)
if (version >= (2020, 2)) //2020.2 and up
  {
      int numEditorDataHash = reader.ReadInt32();
      m_EditorDataHash = new Hash128[numEditorDataHash];
      for (int i = 0; i < numEditorDataHash; i++)
      {
          m_EditorDataHash[i] = new Hash128(reader);
      }
      reader.AlignStream();
      m_Platforms = reader.ReadUInt8Array();
      reader.AlignStream();
      if (version <= (2021, 1)) //2021.1 and down
      {
          m_LocalKeywordMask = reader.ReadUInt16Array();
          reader.AlignStream();
          m_GlobalKeywordMask = reader.ReadUInt16Array();
          reader.AlignStream();
      }
  }

im not sure which version specifically, but i guess it would be

- if (version >= (2020, 2)) //2020.2 and up
+ if (version >= (2020, 2) && version < 6000) //2020.2 and up lower than 6000

also,

// AssetStudio/Classes/Shader.cs (L1006-1007)
    var m_ShaderIsBaked = reader.ReadBoolean();
+ if (version >= 6000)
+  {
+       var m_AssetGUID = reader.ReadBytes(16);
+  }
    reader.AlignStream();

but there's still some shader cant be read properly by ShaderConverter

unity default resources.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions