I want to load an illustrator file in my game. Unity should recognize different layers, colors, and forms, and layers with text and display them in a 2d canvas. The goal is that the players can click on different forms and that unity recognize them as individual forms. Do you know any unity asset or a way to make this possible? For example when you import an image like this as an illustrator file -> https://www.mandala-bilder.de/mandala/erwachsenemandalas/mandala-ideen-erwachsene.pdf I thought about an SVG file but then I can´t use the different layers.
2 回答
Illustrator 具有专有文件格式,它没有针对较新版本的公开可用文档。虽然您可以挖掘旧规范(这就是为什么有些程序只支持保存在古代版本中的 AI 文件)http://www.idea2ic.com/File_Formats/Adobe%20Illustrator%20File%20Format.pdf我不认为你可以进入并开始支持 2021 变体,而无需向 Adobe 请求(和激励)规范。他们可能还想为此向您收费。另一方面,SVG 是免费的,它的规范是公开的,因此得到了广泛的支持。SVG 还支持可以满足您对图层的需求的组
Vector Express 是您应该能够使用的免费转换 API。(不过需要网络连接)
https://github.com/smidyo/vectorexpress-api
您应该能够将请求 ( https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.Post.html ) 发送到此端点,并将原始 AI 文件作为正文:
POST https://vector.express/api/v2/public/convert/ai/gs/pdf/psd2svg/svg/
这将返回一个 JSON 对象,其中包含一个指向 SVG 文件的链接,然后您可以下载并显示该文件。