Код:
Синтаксис:
Используется csharp
for(int i = 0; i < textures.Length;i++)
{
string Path = AssetDatabase.GetAssetPath(textures[i].GetInstanceID());
TextureImporter importer = AssetImporter.GetAtPath(Path) as TextureImporter;
TextureImporterSettings ti = new TextureImporterSettings();
importer.ReadTextureSettings(ti);
ti.readable = true;
importer.SetTextureSettings(ti);
}
atlasCreate = new Texture2D(1, 1, TextureFormat.ARGB32, false);
atlasCreate.PackTextures(textures, 4, 4096, true);
byte[] bytes = atlasCreate.EncodeToPNG();
File.WriteAllBytes(Directory.GetCurrentDirectory() + "/Assets/" + "MyAtlas.png", bytes);
{
string Path = AssetDatabase.GetAssetPath(textures[i].GetInstanceID());
TextureImporter importer = AssetImporter.GetAtPath(Path) as TextureImporter;
TextureImporterSettings ti = new TextureImporterSettings();
importer.ReadTextureSettings(ti);
ti.readable = true;
importer.SetTextureSettings(ti);
}
atlasCreate = new Texture2D(1, 1, TextureFormat.ARGB32, false);
atlasCreate.PackTextures(textures, 4, 4096, true);
byte[] bytes = atlasCreate.EncodeToPNG();
File.WriteAllBytes(Directory.GetCurrentDirectory() + "/Assets/" + "MyAtlas.png", bytes);
Заранее спасибо.