how to make textArea or a textfield uneditable?

I just want it to display text. so it's not modifyable. How could it be done? or is there some better way to display text than text area or text field?

Here’s another option which provides select/copy abilities…

void ReadOnlyTextField(string label, string text)
{
	EditorGUILayout.BeginHorizontal();
	{
		EditorGUILayout.LabelField(label, GUILayout.Width(EditorGUIUtility.labelWidth - 4));
		EditorGUILayout.SelectableLabel(text, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight));
	}
	EditorGUILayout.EndHorizontal();
}

You can use GUI.Label or GUI.Box (if you want a background) instead

If you want to make a textbox uneditable, just don't store the return from the textbox function. It'll only change if you're storing the new value to the variable you're displaying

An even better way of getting the textfield format but leave it uneditable like a lable, is to make a label with a textfield format, like so:

GUI.Label(Rect(x,y,width,height),VariableName,"TextField");

tihs code is true for you:

GUI.TextField(Rect(x,y,width,height)),text,“TextField”);

just don’t save return value from GUI.TextField

I use the following code to have uneditable (but selectable and copyable) text with text-scrollbars:

void ReadOnlyTextField(string text, float Height)
{
    scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Height(Height));
    {
        // Readonly TextArea with working scrollbars
        GUILayout.TextArea(text, EditorStyles.textField, GUILayout.ExpandHeight(true));
    }
    GUILayout.EndScrollView();
}

The GUILayout.ExpandHeight(true) makes the text-scrollbars work.

Surround it with DisableGroup

EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.TextField("ID", "Some Unique ID");
EditorGUI.EndDisabledGroup();