UnityEditor.EditorGUILayout.DelayedTextField C# (CSharp) Method

DelayedTextField() public static method

Make a delayed text field.

public static DelayedTextField ( GUIContent label, string text ) : string
label UnityEngine.GUIContent Optional label to display in front of the int field.
text string The text to edit.
return string
        public static string DelayedTextField(GUIContent label, string text, params GUILayoutOption[] options)
        {
            Rect position = s_LastRect = GetControlRect(true, 16f, EditorStyles.textField, options);
            return EditorGUI.DelayedTextField(position, label, text);
        }

Same methods

EditorGUILayout::DelayedTextField ( GUIContent label, string text, GUIStyle style ) : string
EditorGUILayout::DelayedTextField ( string text ) : string
EditorGUILayout::DelayedTextField ( string text, GUIStyle style ) : string
EditorGUILayout::DelayedTextField ( string label, string text ) : string
EditorGUILayout::DelayedTextField ( string label, string text, GUIStyle style ) : string
EditorGUILayout::DelayedTextField ( UnityEditor.SerializedProperty property ) : void
EditorGUILayout::DelayedTextField ( UnityEditor.SerializedProperty property, GUIContent label ) : void

Usage Example

示例#1
0
        private void TextureGUI()
        {
            data.curve = UGL.CurveField(data.curve);
            int?toRemove = null;

            for (int i = 0; i < data.textureNames.Count; i++)
            {
                UGL.BeginHorizontal();
                data.textureNames[i] = UGL.DelayedTextField(data.textureNames[i], GUILayout.MaxWidth(Screen.width));
                GUILayout.FlexibleSpace();
                Texture2D oldVal = i < data.textures.Count ? data.textures[i]: null;
                Texture2D newVal = (Texture2D)UGL.ObjectField("", oldVal, typeof(Texture2D), true, GUILayout.Width(100));
                UGL.BeginVertical();
                if (GUILayout.Button("Set As Curve", GUILayout.Width(100)))
                {
                    Texture2D text = new Texture2D(100, 1);
                    for (int j = 0; j < text.width; j++)
                    {
                        float sample = data.curve.Evaluate((float)j / text.width);
                        text.SetPixel(j, 0, new Color(sample, sample, sample));
                    }
                    text.Apply();
                    if (text != oldVal)
                    {
                        string path = AssetDatabase.GetAssetPath(data);
                        AssetDatabase.AddObjectToAsset(text, path);
                        newVal = text;
                    }
                }
                GUI.color = Color.red;
                if (GUILayout.Button("-", GUILayout.Width(100)))
                {
                    toRemove = i;
                }
                UGL.EndVertical();
                GUI.color = Color.white;
                if (oldVal != newVal)
                {
                    if (!data.textures.Contains(oldVal))
                    {
                        data.textures.Add(newVal);
                    }
                    else
                    {
                        data.textures[data.textures.IndexOf(oldVal)] = newVal;
                    }
                }
                UGL.EndHorizontal();
            }
            if (toRemove != null)
            {
                data.textureNames.RemoveAt((int)toRemove);
            }
        }
All Usage Examples Of UnityEditor.EditorGUILayout::DelayedTextField