Removed TOTU 103
This commit is contained in:
		
							
								
								
									
										24
									
								
								Assets/Scripts/UIContentFitter.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								Assets/Scripts/UIContentFitter.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| using UnityEngine.UI; | ||||
|  | ||||
| public class UIContentFitter : MonoBehaviour | ||||
| { | ||||
|     // Start is called before the first frame update | ||||
|     void Start() | ||||
|     { | ||||
|         HorizontalLayoutGroup hg = GetComponent<HorizontalLayoutGroup>(); | ||||
|         int childCount =  transform.childCount - 1; | ||||
|         float childWidth = transform.GetChild(0).GetComponent<RectTransform>().rect.width; | ||||
|         float width = hg.spacing * childCount + childCount * childWidth + hg.padding.left; | ||||
|  | ||||
|         GetComponent<RectTransform>().sizeDelta = new Vector2(width, 265); | ||||
|     } | ||||
|  | ||||
|     // Update is called once per frame | ||||
|     void Update() | ||||
|     { | ||||
|          | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Ignacio Gómez Puga
					Ignacio Gómez Puga