我有一行代码用于从该项目中提取图像数据,但由于 imageItem = null,代码会跳过。这可能是什么原因?
foreach (Layer layer in level.Layers)
{
foreach (Item item in layer.Items)
{
ImageItem imageItem = item as ImageItem;
if (imageItem != null)
{
Texture2D texture = imageItem.Texture;
imageItemList[iImageItemNum].itemTextureDataList[0] =
new Color[imageItem.Texture.Width * imageItem.Texture.Height];
imageItem
.Texture
.GetData(imageItemList[iImageItemNum]
.itemTextureDataList[0]);
iImageItemNum++;
}
}
}