[UE4]Canvas Panel和Uniform Grid Panel的区别(UMG Widget)

打开Widget蓝图,在Palette(画板)面板中,可以选择Widget最外层的Panel类型,默认已经帮你建了一个Canvas Panel,看了下文档:

https://docs.unrealengine.com/latest/INT/Engine/UMG/UserGuide/WidgetTypeReference/index.html

这个Canvas Panel内部不适合通过代码动态创建widget,除非你想创建的widget位置是绝对路径Canvas Panel的好处是可以任意摆放widget,Unitform Grid Panle缺点是位置相对固定,优点是可以自动对齐。官方的三消游戏项目,使用了好几个Unitform Grid Panle,没有用到Canvas Panel。两种Panel的解释如下:

Canvas Panel

The canvas panel is a designer friendly panel that allows widgets to be laid out at arbitrary locations, anchored and z-ordered with other children of the canvas. The canvas panel is a great widget for manual layout, but bad when you want to procedurally just generate widgets and place them in a container (unless you want absolute layout). For more information on Anchors, see the Anchors page.

Uniform Grid Panel

A panel that evenly divides up available space between all of its children.

 

 



 

猜你喜欢

转载自aigo.iteye.com/blog/2268369
今日推荐