IOSBarResizer.cs 764 Bytes
using System;
using UnityEngine;
using UnityEngine.UI;

public class IOSBarResizer : MonoBehaviour {

	protected void Start ()
	{
		HorizontalLayoutGroup barBottomLayout = gameObject.GetComponent<HorizontalLayoutGroup>();

		if (Screen.dpi < 140)
		{
			barBottomLayout.spacing = 42;
		}

		// 240
		else if (Screen.dpi < 280)
		{
			barBottomLayout.spacing = 72;
		}

		// 320
		else if (Screen.dpi < 400)
		{
			barBottomLayout.spacing = 108;
		}

		// 480
		else if (Screen.dpi < 500)
		{
			barBottomLayout.spacing = 158;
		}

		else
		{
			barBottomLayout.spacing = 108;
		}
	}

	public void _set_(InputField inf) {
		gameObject.GetComponent<HorizontalLayoutGroup>().spacing = Convert.ToInt32(inf.text);
		Debug.Log("sp: " + Convert.ToInt32(inf.text));
	}

}