![](/img/trans.png)
[英]How do I get a Unity Scroll Rect to scroll to the bottom after the content's Rect Transform is updated by a Content Size Fitter?
[英]How do i change the Rect Transform in Unity in a script
我正在嘗試更改矩形變換中的寬度和高度。 但我無法在我的腳本中更改它。 有誰知道如何改變它?
我找到了這個並嘗試了但沒有用
RectTransform rt = canvas.GetComponent<RectTransform>();
rt.sizeDelta = new Vector2(700, 500);
我想出了如何選擇 position,而不是寬度和高度。
我不確定我是否從未處理過更改 Rect Transform 的寬度,但您可以嘗試將變量更改為類似“public RectTransform rt;”的內容然后將 object 分配給變量。 或者試試“[SerializeField] RectTransform rt;”。 盡管我不確定該變量是否可以解決任何問題。 希望這可以幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.