Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Is there a super simple way to display read only textarea in a component?

Discussion in 'Scripting' started by supernamey923834, Aug 31, 2021.

  1. supernamey923834

    supernamey923834

    Joined:
    Jul 27, 2017
    Posts:
    10
    Right now I am leaving simple notes either in a string like so
    Or im putting this into a simple component
    Code (CSharp):
    1.  
    2. [TextArea(4,20)]
    3. public string notesLike;
    4.  
    What I would like is simply one extra argument bool to denote readonly
    [TextArea(4,20, false)]

    I saw a various ton of solutions within the nets but either they are not as simple as a one line, or they dont compile to android.

    Is their such a simple solution?
    No fancy styling needed, the default render of UI works fine
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,769
    What do you mean readonly? You just want reference notes to be visible in your inspector window?

    For that I usually just use the
    [Header("Connect this to the player's blah blah blah")]
    construct.

    If it is per-instance stuff, then I just make a multiline field called
    Comments
    and leave it at that.

    Could also just make a custom inspector with a hidden backing store that requires an extra button press before you can change the contents, etc.
     
  3. supernamey923834

    supernamey923834

    Joined:
    Jul 27, 2017
    Posts:
    10
    a greyed out multi line text box. Just like Header but multi line. I would like the option instead of being able to edit it in editor, no button option