# 导入资源失败: 'Assets/Textures/photo.cr2'。错误: 无法解码原始图像数据

- **ID:** `unity/asset-import-cr2-raw-not-supported`
- **领域:** unity
- **类别:** resource_error
- **验证级别:** ai_generated
- **修复率:** 95%

## 根因

Unity的纹理导入器不支持佳能CR2原始图像格式；它期望标准格式如PNG、JPG、TGA或EXR。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Unity 2021.3 | active | — | — |
| Unity 2022.3 | active | — | — |
| Unity 2023.2 | active | — | — |

## 解决方案

1. ```
   使用外部工具如Adobe Photoshop、GIMP或ImageMagick将CR2文件转换为支持的格式（如PNG、JPG或EXR）。命令示例：magick convert photo.cr2 photo.png
   ```
2. ```
   如果需要原始图像用于高动态范围，转换为EXR或HDR格式而不是PNG/JPG以保留数据。
   ```
3. ```
   使用自定义导入器或脚本，通过第三方库（如LibRaw）在运行时加载CR2文件，完全绕过Unity的导入管线。
   ```

## 无效尝试

- **** — Renaming does not change the internal file format; Unity will still attempt to decode the raw data and fail with a similar error. (98% 失败率)
- **** — Unity does not use system codecs for texture import; it relies on built-in decoders for supported formats only. (90% 失败率)
- **** — Re-saving in the same format does not change the encoding; Unity still cannot decode it. (95% 失败率)
