unity ScrollRect.normalizedPosition
时间: 2024-05-08 21:17:05 浏览: 9
The ScrollRect.normalizedPosition property in Unity is a floating-point value that represents the normalized position of the content within the ScrollRect. It is a vector2 value that ranges between (0,0) and (1,1), where (0,0) represents the top-left corner of the content, and (1,1) represents the bottom-right corner of the content.
The ScrollRect.normalizedPosition property can be used to set or get the current position of the content within the ScrollRect. For example, to scroll to the bottom of the content, you can set the ScrollRect.normalizedPosition property to (0,1).
Here's an example of how to use the ScrollRect.normalizedPosition property to scroll to the bottom of a ScrollRect:
```
// Get the ScrollRect component
ScrollRect scrollRect = GetComponent<ScrollRect>();
// Set the normalized position to scroll to the bottom
scrollRect.normalizedPosition = new Vector2(0, 1);
```
In this example, we first get the ScrollRect component attached to the GameObject. Then, we set the ScrollRect.normalizedPosition property to (0,1) to scroll to the bottom of the content.
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)