支持多行文字,底图随着文字的长度变化而自适应大小,比如游戏中常见的聊天系统,信息中都会有一个信息的底图,底图会根据文字的长宽而发生变化,例如QQ聊天也是如此的功能,unity中UGUI实现完全不需要一句代码就可以实现,具体的看下面的截图,然后自己去做一下测试就好了
![img_ae1cf7c0dcfce91d8121f22399bdc8de.gif](https://yqfile.alicdn.com/img_ae1cf7c0dcfce91d8121f22399bdc8de.gif)
测试效果.gif
一:BG上面挂载下图相对应组件,设置即可,具体根据图的比例设置
![img_ac2b66ee05f9ea99bd13d92e16c61b73.png](https://yqfile.alicdn.com/img_ac2b66ee05f9ea99bd13d92e16c61b73.png?x-oss-process=image/resize,w_1400/format,webp)
第一步.png
二:填充text内容,换行都可以自动适应
![img_c5416ff6518fcd2e62f08483391c9dd2.png](https://yqfile.alicdn.com/img_c5416ff6518fcd2e62f08483391c9dd2.png?x-oss-process=image/resize,w_1400/format,webp)
第二部.png
背景随着item增加而增加与减少
![img_ee54c6001fe5b9309755b574ff6b9b0d.png](https://yqfile.alicdn.com/img_ee54c6001fe5b9309755b574ff6b9b0d.png?x-oss-process=image/resize,w_1400/format,webp)
图片.png
![img_5926700b70d0e17970b604ffd4c07f32.png](https://yqfile.alicdn.com/img_5926700b70d0e17970b604ffd4c07f32.png?x-oss-process=image/resize,w_1400/format,webp)
图片.png
![img_8d7c0394d7aee9581f04076e4cbf0e4b.png](https://yqfile.alicdn.com/img_8d7c0394d7aee9581f04076e4cbf0e4b.png?x-oss-process=image/resize,w_1400/format,webp)
图片.png
![img_1ef6b5f29553ee53dd69b50c0e1c7072.png](https://yqfile.alicdn.com/img_1ef6b5f29553ee53dd69b50c0e1c7072.png?x-oss-process=image/resize,w_1400/format,webp)
图片.png