使用与利弊:
https://docs.unity3d.com/2018.4/Documentation/ScriptReference/UI.RawImage.html
Displays a Texture2D for the UI System.
Keep in mind that this will create an extra draw call with each RawImage present, so it’s best to use it only for backgrounds or temporary visible graphics.
以上是官方说法。
然而多嘴一句:其实看动态生成atlas方案的时候就会发现,RawImage也是能合并dc的┓( ´∀` )┏,而且动态管理和显示的时候不用Sprite.Create, 但Image所提供的那些mode它确实是没有。
https://docs.unity3d.com/2018.4/Documentation/ScriptReference/UI.Image.html
Displays a Sprite for the UI System.
https://answers.unity.com/questions/1070280/raw-image-vs-image.html
一般ui上都用Image(可合批,搞图集、即使非图集,TextureType为Sprite),特殊的Texture(如rt等)可用RawImageSprite.Create
可转换为sprite用Image组件,但这样比较费性能。
源码地址:
2018.4版本:
https://github.com/Unity-Technologies/uGUI/blob/2018.4/UnityEngine.UI/UI/Core/Image.cs
https://github.com/Unity-Technologies/uGUI/blob/2018.4/UnityEngine.UI/UI/Core/RawImage.cs
源码解析:
简略版:知乎鹅厂小哥:
详细版:(推荐阅读此人的Image)
dmk17771552304 @csdn