UnityEngine.GUI.Label(UnityEngine.Rect, UnityEngine.GUIContent)

Here are the examples of the csharp api UnityEngine.GUI.Label(UnityEngine.Rect, UnityEngine.GUIContent) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

7 Examples 7

19 View Source File : AssetPathDrawer.cs
License : MIT License
Project Creator : ByronMayne

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        property = GetProperty(property);
        if (property.propertyType != SerializedPropertyType.String)
        {
            // Create a rect for our label
            Rect labelPosition = position;
            // Set it's width 
            labelPosition.width = EditorGUIUtility.labelWidth;
            // Draw it
            GUI.Label(labelPosition, label);
            // Create a rect for our content
            Rect contentPosition = position;
            // Move it over by the x
            contentPosition.x += labelPosition.width;
            // Shrink it in width since we moved it over
            contentPosition.width -= labelPosition.width;
            // Draw our content warning;
            EditorGUI.HelpBox(contentPosition, m_InvalidTypeLabel + this.fieldInfo.FieldType.Name, MessageType.Error);
        }
        else
        {
            HandleObjectReference(position, property, label);
        }

    }

19 View Source File : FolderFilterWidget.cs
License : MIT License
Project Creator : ByronMayne

protected virtual void OnDrawFoldersHeader(Rect rect)
        {
            GUI.Label(rect, m_Foldersreplacedle);
        }

19 View Source File : ResourcesWidget.cs
License : MIT License
Project Creator : ByronMayne

private void OnDrawHeader(Rect rect)
        {
            GUI.Label(rect, m_HeaderLabel);
        }

19 View Source File : AssetBundleTree.cs
License : GNU General Public License v3.0
Project Creator : Cytoid

protected override void RowGUI(RowGUIArgs args)
        {
            var bundleItem = (args.item as replacedetBundleModel.BundleTreeItem);
            if (args.item.icon == null)
                extraSpaceBeforeIconAndLabel = 16f;
            else
                extraSpaceBeforeIconAndLabel = 0f;

            Color old = GUI.color;
            if ((bundleItem.bundle as replacedetBundleModel.BundleVariantFolderInfo) != null)
                GUI.color = replacedetBundleModel.Model.k_LightGrey; //new Color(0.3f, 0.5f, 0.85f);
            base.RowGUI(args);
            GUI.color = old;

            var message = bundleItem.BundleMessage();
            if(message.severity != MessageType.None)
            {
                var size = args.rowRect.height;
                var right = args.rowRect.xMax;
                Rect messageRect = new Rect(right - size, args.rowRect.yMin, size, size);
                GUI.Label(messageRect, new GUIContent(message.icon, message.message ));
            }
        }

19 View Source File : RangedFloatDrawer.cs
License : MIT License
Project Creator : Interactml

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            label = EditorGUI.BeginProperty(position, label, property);
            position = EditorGUI.PrefixLabel(position, label);

            SerializedProperty minProp = property.FindPropertyRelative("minValue");
            SerializedProperty maxProp = property.FindPropertyRelative("maxValue");

            float minValue = minProp.floatValue;
            float maxValue = maxProp.floatValue;

            float rangeMin = 0;
            float rangeMax = 1;

            var ranges = (MinMaxRangeAttribute[])fieldInfo.GetCustomAttributes(typeof(MinMaxRangeAttribute), true);
            if (ranges.Length > 0)
            {
                rangeMin = ranges[0].Min;
                rangeMax = ranges[0].Max;
            }

            const float rangeBoundsLabelWidth = 40f;

            var rangeBoundsLabel1Rect = new Rect(position);
            rangeBoundsLabel1Rect.width = rangeBoundsLabelWidth;
            GUI.Label(rangeBoundsLabel1Rect, new GUIContent(minValue.ToString("F2")));
            position.xMin += rangeBoundsLabelWidth;

            var rangeBoundsLabel2Rect = new Rect(position);
            rangeBoundsLabel2Rect.xMin = rangeBoundsLabel2Rect.xMax - rangeBoundsLabelWidth;
            GUI.Label(rangeBoundsLabel2Rect, new GUIContent(maxValue.ToString("F2")));
            position.xMax -= rangeBoundsLabelWidth;

            EditorGUI.BeginChangeCheck();
            EditorGUI.MinMaxSlider(position, ref minValue, ref maxValue, rangeMin, rangeMax);
            if (EditorGUI.EndChangeCheck())
            {
                minProp.floatValue = minValue;
                maxProp.floatValue = maxValue;
            }

            EditorGUI.EndProperty();
        }

19 View Source File : SerializableDictionaryPropertyDrawer.cs
License : MIT License
Project Creator : Interactml

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
	{
		label = EditorGUI.BeginProperty(position, label, property);

		Action buttonAction = Action.None;
		int buttonActionIndex = 0;

		var keyArrayProperty = property.FindPropertyRelative(KeysFieldName);
		var valueArrayProperty = property.FindPropertyRelative(ValuesFieldName);

		ConflictState conflictState = GetConflictState(property);

		if(conflictState.conflictIndex != -1)
		{
			keyArrayProperty.InsertArrayElementAtIndex(conflictState.conflictIndex);
			var keyProperty = keyArrayProperty.GetArrayElementAtIndex(conflictState.conflictIndex);
			SetPropertyValue(keyProperty, conflictState.conflictKey);
			keyProperty.isExpanded = conflictState.conflictKeyPropertyExpanded;

			if(valueArrayProperty != null)
			{
				valueArrayProperty.InsertArrayElementAtIndex(conflictState.conflictIndex);
				var valueProperty = valueArrayProperty.GetArrayElementAtIndex(conflictState.conflictIndex);
				SetPropertyValue(valueProperty, conflictState.conflictValue);
				valueProperty.isExpanded = conflictState.conflictValuePropertyExpanded;
			}
		}

		var buttonWidth = s_buttonStyle.CalcSize(s_iconPlus).x;

		var labelPosition = position;
		labelPosition.height = EditorGUIUtility.singleLineHeight;
		if (property.isExpanded)
			labelPosition.xMax -= s_buttonStyle.CalcSize(s_iconPlus).x;

		EditorGUI.PropertyField(labelPosition, property, label, false);
		// property.isExpanded = EditorGUI.Foldout(labelPosition, property.isExpanded, label);
		if (property.isExpanded)
		{
			var buttonPosition = position;
			buttonPosition.xMin = buttonPosition.xMax - buttonWidth;
			buttonPosition.height = EditorGUIUtility.singleLineHeight;
			EditorGUI.BeginDisabledGroup(conflictState.conflictIndex != -1);
			if(GUI.Button(buttonPosition, s_iconPlus, s_buttonStyle))
			{
				buttonAction = Action.Add;
				buttonActionIndex = keyArrayProperty.arraySize;
			}
			EditorGUI.EndDisabledGroup();

			EditorGUI.indentLevel++;
			var linePosition = position;
			linePosition.y += EditorGUIUtility.singleLineHeight;
			linePosition.xMax -= buttonWidth;

			foreach(var entry in EnumerateEntries(keyArrayProperty, valueArrayProperty))
			{
				var keyProperty = entry.keyProperty;
				var valueProperty = entry.valueProperty;
				int i = entry.index;

				float lineHeight = DrawKeyValueLine(keyProperty, valueProperty, linePosition, i);

				buttonPosition = linePosition;
				buttonPosition.x = linePosition.xMax;
				buttonPosition.height = EditorGUIUtility.singleLineHeight;
				if(GUI.Button(buttonPosition, s_iconMinus, s_buttonStyle))
				{
					buttonAction = Action.Remove;
					buttonActionIndex = i;
				}

				if(i == conflictState.conflictIndex && conflictState.conflictOtherIndex == -1)
				{
					var iconPosition = linePosition;
					iconPosition.size =  s_buttonStyle.CalcSize(s_warningIconNull);
					GUI.Label(iconPosition, s_warningIconNull);
				}
				else if(i == conflictState.conflictIndex)
				{
					var iconPosition = linePosition;
					iconPosition.size =  s_buttonStyle.CalcSize(s_warningIconConflict);
					GUI.Label(iconPosition, s_warningIconConflict);
				}
				else if(i == conflictState.conflictOtherIndex)
				{
					var iconPosition = linePosition;
					iconPosition.size =  s_buttonStyle.CalcSize(s_warningIconOther);
					GUI.Label(iconPosition, s_warningIconOther);
				}


				linePosition.y += lineHeight;
			}

			EditorGUI.indentLevel--;
		}

		if(buttonAction == Action.Add)
		{
			keyArrayProperty.InsertArrayElementAtIndex(buttonActionIndex);
			if(valueArrayProperty != null)
				valueArrayProperty.InsertArrayElementAtIndex(buttonActionIndex);
		}
		else if(buttonAction == Action.Remove)
		{
			DeleteArrayElementAtIndex(keyArrayProperty, buttonActionIndex);
			if(valueArrayProperty != null)
				DeleteArrayElementAtIndex(valueArrayProperty, buttonActionIndex);
		}

		conflictState.conflictKey = null;
		conflictState.conflictValue = null;
		conflictState.conflictIndex = -1;
		conflictState.conflictOtherIndex = -1;
		conflictState.conflictLineHeight = 0f;
		conflictState.conflictKeyPropertyExpanded = false;
		conflictState.conflictValuePropertyExpanded = false;

		foreach(var entry1 in EnumerateEntries(keyArrayProperty, valueArrayProperty))
		{
			var keyProperty1 = entry1.keyProperty;
			int i = entry1.index;
			object keyProperty1Value = GetPropertyValue(keyProperty1);

			if(keyProperty1Value == null)
			{
				var valueProperty1 = entry1.valueProperty;
				SaveProperty(keyProperty1, valueProperty1, i, -1, conflictState);
				DeleteArrayElementAtIndex(keyArrayProperty, i);
				if(valueArrayProperty != null)
					DeleteArrayElementAtIndex(valueArrayProperty, i);

				break;
			}


			foreach(var entry2 in EnumerateEntries(keyArrayProperty, valueArrayProperty, i + 1))
			{
				var keyProperty2 = entry2.keyProperty;
				int j = entry2.index;
				object keyProperty2Value = GetPropertyValue(keyProperty2);

				if(ComparePropertyValues(keyProperty1Value, keyProperty2Value))
				{
					var valueProperty2 = entry2.valueProperty;
					SaveProperty(keyProperty2, valueProperty2, j, i, conflictState);
					DeleteArrayElementAtIndex(keyArrayProperty, j);
					if(valueArrayProperty != null)
						DeleteArrayElementAtIndex(valueArrayProperty, j);

					goto breakLoops;
				}
			}
		}
		breakLoops:

		EditorGUI.EndProperty();
	}

19 View Source File : EasyTouchWelcomeScreen.cs
License : MIT License
Project Creator : XINCGer

public void OnGUI(){

		InitInterface();
		GUI.Box(new Rect(0, 0, width, 60), "", imgHeader);
		GUI.Label( new Rect(width-90,45,200,20),new GUIContent("Version : " +VERSION));
		GUILayoutUtility.GetRect(position.width, 64);

		GUILayout.BeginVertical();

		if (Button(playmakerIcon,"Install PlayMaker add-on","Requires PlayMaker 1.8 or higher.")){
			InstallPlayMakerAddOn();
		}

		if (Button(jsIcon,"Switch to JS","Switch Easy Touch folder structure to be used with Java Script.")){
			JsFolders();
		}

		if (Button(cIcon,"Revert to original","Revert Easy Touch folder structure to original (C#).")){
			CFolders();
		}

		if (Button(supportIcon,"Community Forum","You need your invoice number to register, if you are a new user.")){
			Application.OpenURL(SUPPORTURL);
		}

		if (Button(supportIcon,"Official topic","Official topic on Unity Forum.",3)){
			Application.OpenURL(OFFICIALTOPIC);
		}

		bool show = GUILayout.Toggle(showAtStartup, "Show at startup");
		if (show != showAtStartup){
			showAtStartup = show;
			EditorPrefs.SetBool(PREFSHOWATSTARTUP, showAtStartup);
		}

		GUILayout.EndVertical();

	}