首先,我们看一下官方说明。
This is only useful for text meshes and renders an image inline with
the text.
关键词在于:text meshes
和 image inline
——这说明,<quad/>
设计是用在TextMesh
而不是Text
,并且它是一个文本内嵌图片
,即可以自动图文混排
。
其次,看一下官方例子。
<quad material=1 size=20 x=0.1 y=0.1 width=0.5 height=0.5>
This selects the material at position in the renderer’s material array
and sets the height of the image to 20 pixels.
- material——是
TextMesh
对应MeshRender
中Materials
数组的索引。 - size——是图片的
像素高度
。
The rectangular area of image starts at given by the x, y, width and height values, which are all given as a fraction of the unscaled width and height of the texture.
- x,y——是图片在texture上的
百分比偏移
,如果texture是一个纹理集合,上面有很多表情,就可以用xy偏移到其中任意一个表情。 - width——是图片显示宽度的
百分比缩放
,即:显示宽度 = size * width。也就是说,width越大,图片显示宽度越大,反之越小。
<quad material=1 size=0300 width=2 height=1 />
<quad material=1 size=0300 width=1 height=1 />
<quad material=1 size=0300 width=0.5 height=1 />
- height——是图片显示高度的