Search Unity

Scriptable Objects TMPro

Discussion in 'Editor & General Support' started by AverageTom, Jul 30, 2019.

  1. AverageTom

    AverageTom

    Joined:
    Jun 17, 2019
    Posts:
    1
    Hello all,

    I’m creating a game which has a load of 3D models all requiring the same information, that I’m attaching Scriptable Objects to in the style of:

    new public string name = "New Custom Object";
    public string generalInfo;
    public string loreInfo;
    public string relationsInfo;

    When a user selects a new object, a UI panel on the side is updated with the objects general information by default, with tabs to switch between lore and relations info too.

    However, as the information is paragraphs in length for each of the 3 strings and requires TMPro tag compatibility (for inline sprites etc.), I’m having issues typing the information into the inspector for each object as it all goes in 1 long line.

    If anyone could help me with finding a way of making the inspector show the text I enter similar to the default TMPro inspector that would be greatly appreciated.

    Many thanks,

    Tom

    P.S: I’m assuming using scriptable objects to attach to each 3D model is better than storing the information as typed C# script files and calling methods to update the UI?
     
  2. Wezai

    Wezai

    Joined:
    Dec 30, 2016
    Posts:
    74
    Try putting this above your variable responsible for the text:
    Code (CSharp):
    1. [TextArea(15,20)]        // Min and max amount of lines displayed before scrollbar starts to roll.
    2. public string myText;    // Now myText will have a bigger box in the inspector.
     
    Last edited: Jul 30, 2019
    AverageTom likes this.