Code Monkey home page Code Monkey logo

psd2unity's Introduction

PSD2Unity

PS中导出切图到Untiy生成UGUI界面和场景

How to use

  1. 通过UnityPackageManager导入包

  2. ExportToPNG ps脚本放在PhotoShop软件Scripts文件夹

    image-20220219221748479

  3. PS中操作

    image-20220219221854573

    image-20220219221920658

    • Write Layer Pngs 将ps中图层导出png
    • Ignore hidden Layer 忽略隐藏图层 ,如果勾选则不导出PS中隐藏图层
    • Write a template PNG 写入一张模板
    • User groups 是否使用组,勾选会按PS组导出
    • Write Json 是否导出json, Unity中会用到
    • Trim Whitespace 是否去除空白,不勾选则导出原始画布尺寸

    等待一段时间之后,在对应的文件夹会生成相应的资源文件

    image-20220219222232023


    tip:添加快捷键

  4. 将生成的文件导入Unity中,然后将图片格式设置成Sprite

  5. 选中生成的xxx.ps.json,然后右键PSDTools/PSD2Scene或者PSDTools/PSD2UGUI生成界面

    gif

  6. 可以导入示例查看具体使用


ChangeLog

1.0.6

  • 之前保存为.ps.json格式,现在改成.ps.data格式(.json会默认为unity的textasset,会参与打AssetBundle, .data则不会,参考:Unity - Manual: Text assets (unity3d.com))
  • 不在自动生成Prefab预制体(自己手动拖一下吧)
  • 调整代码,将菜单order=500

1.0.5

  • 修改成UnityPackage

1.0.4

  • 修改了json结构,更加清晰明了

1.0.3

  • 添加提示:同一个组下有相同图层名,导致未能正确保存问题

1.0.2

  • 修复User groups(按组导出)时没有按照ps中结构正确生成组的bug
  • 添加了导出png图片过大问题,也就是导出时写入了xmp数据导致图片内存异常大

参考

❤️ ❤️ ❤️ ❤️ ❤️

Spine 2D - LayersToPNG.jsx fix for Photoshop CC (github.com)

EsotericSoftware/spine-scripts: Scripts to export from PhotoShop and other tools to Spine's JSON data format. (github.com)

解决Photoshop CC导出JPG文件过大的问题)

其他

由于使用了Newtonsoft.Json(至少版本>=unity2021.3.16自带了)

如果提示缺失该程序集找到PSD2Unity下的Editor/NewtonsoftJson~把后面的~去除即可

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.