0
Under review

Code-Node: Tabs are to wide + a scrollbar would be nice

Sascha Seewald 9 years ago updated by Freya Holmér (Developer) 9 years ago 4
...
Zooming should be disabled in edit mode - "the Focus" if possible should be set to the input field.
Under review
In case you didn't notice - you can resize the code node.
That said, the tab size is pretty ridiculous, but I can't seem to find a way to set it :(
Hi Joachim - yep currently the only way.

Hm, I see... looked into the docs and i'm shocked :O.

Here is a starting point (at least for scrollbars and styling things):

using UnityEngine;
using UnityEditor;

public class ExampleEditor : EditorWindow {
    string fieldValue = "Some Value";
    Vector2 scrollPosition = Vector2.zero;
    [MenuItem ("Window/My Window")]
    public static void  ShowWindow () {
        EditorWindow.GetWindow(typeof(ExampleEditor));
    }
    void OnGUI () {    
        // Fetch the text area style from the current GUI skin
        GUIStyle textAreaStyle = GUI.skin.textArea;
        // Change some definitions
        textAreaStyle.richText = true;
        textAreaStyle.padding.left = 10;
        textAreaStyle.padding.top = 10;
        textAreaStyle.padding.right = 10;
        textAreaStyle.padding.bottom = 10;
        textAreaStyle.stretchHeight = true;
        // Create a space for the text area
        Rect bounds = new Rect(5, 10, Screen.width - 10, Screen.height - 40);
        // Define a scrollable area
        GUILayout.BeginArea(bounds);
        scrollPosition = GUILayout.BeginScrollView(scrollPosition);
        // Add the text area
        fieldValue = EditorGUILayout.TextArea (fieldValue, 
                                               textAreaStyle,
                                               GUILayout.MinWidth(bounds.width - 30 ),
                                               GUILayout.MaxHeight(bounds.height));
        GUILayout.EndScrollView();
        GUILayout.EndArea();
    }
}


The scrollbar isn't the tricky part - it's the tab size I can't seem to find how to change size of. It seems to be set to 16 characters long at the moment. Thanks though :)