Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

GUILayout.MinHeight

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual
public static function MinHeight(minHeight: float): GUILayoutOption;
public static GUILayoutOption MinHeight(float minHeight);

Parámetros

Descripción

Option passed to a control to specify a minimum height.


Minimum height for a window.

	// Draws a window you can resize between 80px and 200px height
	// Just click the box inside the window and move your mouse
	private var windowRect : Rect = Rect (10, 10, 100, 100);
	private var scaling : boolean = false;
	
	function OnGUI () {
		windowRect = GUILayout.Window (0, windowRect, ScalingWindow, "resizeable", 
					       GUILayout.MinHeight(80), GUILayout.MaxHeight(200));
	}
	
	function ScalingWindow (windowID : int) {
		GUILayout.Box("", GUILayout.Width(20), GUILayout.Height(20));
		if (Event.current.type == EventType.MouseUp) {
			scaling = false;
		}
		else if (Event.current.type == EventType.MouseDown && 
			 GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) {
			scaling = true;
		}
		
		if (scaling) {
			windowRect = Rect (windowRect.x, windowRect.y, 
				   windowRect.width + Event.current.delta.x, windowRect.height + Event.current.delta.y);
		}
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { private Rect windowRect = new Rect(10, 10, 100, 100); private bool scaling = false; void OnGUI() { windowRect = GUILayout.Window(0, windowRect, ScalingWindow, "resizeable", GUILayout.MinHeight(80), GUILayout.MaxHeight(200)); } void ScalingWindow(int windowID) { GUILayout.Box("", GUILayout.Width(20), GUILayout.Height(20)); if (Event.current.type == EventType.MouseUp) scaling = false; else if (Event.current.type == EventType.MouseDown && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) scaling = true; if (scaling) windowRect = new Rect(windowRect.x, windowRect.y, windowRect.width + Event.current.delta.x, windowRect.height + Event.current.delta.y); } }