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

Report a bug about at3 #116

Open
liuxinyumocn opened this issue Aug 8, 2023 · 0 comments
Open

Report a bug about at3 #116

liuxinyumocn opened this issue Aug 8, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@liuxinyumocn
Copy link

AssetsTools.NET.Texture/TextureFile.cs - SetTextureDataRaw( ... )
This function code:

public void SetTextureDataRaw(byte[] encodedData, int width, int height)
 {
    ...
    m_StreamData.path = null;
    ...
}

And in WriteTo(AssetTypeValueField baseField) end:

AssetTypeValueField streamData;
if (!(streamData = baseField["m_StreamData"]).IsDummy)
 {
    ...
    streamData["path"].AsString = m_StreamData.path;
}

m_StreamData.path is null , AsString code is set => Value = Encoding.UTF8.GetBytes(value); will throw a Exception.

My full codes:

tf.SetTextureDataRaw(bytes, width, height);
tf.m_TextureFormat = (int)TextureFormat.ETC_RGB4;
tf.m_MipMap = false;
tf.m_MipCount = 1;
tf.WriteTo(baseField);  // Error!

So... AsString was modified to ?

Value = value == null ? new byte[0] : Encoding.UTF8.GetBytes(value);
@nesrak1 nesrak1 added the bug Something isn't working label Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants