[Unity] Scroll View of Content can not be fully displayed sub-UI solution to the problem

Disclaimer: This blog seriousness nonsense, the article content can not reference. This article is a blogger original article, shall not be reproduced without the bloggers allowed. Pictures are resources for learning to share use for reference purposes only, not for commercial behavior of the blog used. Communicators conceited. If this blog article written infringe your rights, please reach out to leave a message, we will promptly remove content. https://blog.csdn.net/BuladeMian/article/details/90340608

 

 

 

Inspector view the contents of Scroll View.

 

Scroll View

-Viewport

--Content

--- UI Image

--- Image 1 IU

--- IU Image 2

-Scrollbar Horizontal

-Scrollbar Vertiacl

 


Scroll View's Content can not fully display the sub UI 

Solutions.

 

Height RectTransform adjustment component of Content. (Vertical Fit ContentSizeFitter assembly when Content no effect when provided, the following code may be used.)


            float height = UIimage.GetComponent<RectTransform>().sizeDelta.y;//t为子UI(UI Image)
            height = height * i;//i是显示子UI(UI Image)的 数量
            Vector2 vector2 = Panel_content.GetComponent<RectTransform>().sizeDelta;
            Panel_content.GetComponent<RectTransform>().sizeDelta = new Vector2(vector2.x, height);//仅仅改变 Content的 RectTransform组件的Height即可。

 


Scroll View of the vertical slider Scrollbar Vertiacl not be fully displayed in the sub-UI solution.

 

Scrollbar Scrollbar Vertiacl a component to adjust to the size Size Scrollbar assembly.

 

 

 

 


 

References:

1. Unity4.6 modify the width and height RectTransform

2.

3.

 

 

 

 

Guess you like

Origin blog.csdn.net/BuladeMian/article/details/90340608