Textmeshextension

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Description: added note that this is unnecessary.)
(Description)
 
Line 4: Line 4:
 
In the current version of Unity (4.3.4) the component TextMesh contains a text field that does not accept enter as new line. This script creates a new field, above the standard, that allows new lines to be entered by pressing enter.
 
In the current version of Unity (4.3.4) the component TextMesh contains a text field that does not accept enter as new line. This script creates a new field, above the standard, that allows new lines to be entered by pressing enter.
  
NOTE: This class is unnecessary; you can add a new line to any single-line text field without any editor extensions. See the [http://wiki.unity3d.com/index.php/Talk:Textmeshextension Textmeshextension Talk page] for details.
+
NOTE: This class is only necessary if you are unable to create new lines by pressing shift+enter; See the [http://wiki.unity3d.com/index.php/Talk:Textmeshextension Textmeshextension Talk page] for details.
  
 
== Script and Usage ==
 
== Script and Usage ==

Latest revision as of 20:55, 7 April 2014

[edit] Description

In the current version of Unity (4.3.4) the component TextMesh contains a text field that does not accept enter as new line. This script creates a new field, above the standard, that allows new lines to be entered by pressing enter.

NOTE: This class is only necessary if you are unable to create new lines by pressing shift+enter; See the Textmeshextension Talk page for details.

[edit] Script and Usage

Create a script named "TextMeshExtension.js" with the contents as shown below and place it inside the "Editor" folder.

 
@CustomEditor (TextMesh)
class TextMeshExtension extends Editor{
    function OnInspectorGUI () {
        target.text = EditorGUILayout.TextArea(target.text);
        DrawDefaultInspector();
    }
}
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox