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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Editor Window Array to Scrollview

Discussion in 'Editor & General Support' started by RPGFabi, Jan 14, 2020.

  1. RPGFabi

    RPGFabi

    Joined:
    Oct 24, 2019
    Posts:
    29
    Hey,
    I'm currently working on an localization Editor in the Unity Editor.

    Currently the Save, Create and Load Buttons are there and doing their Stuff.
    The Scrollbar on the right is also there.
    Also the Data (which contains key and value) is correctly created, but not added to the Scrollbar.

    What shouldbe working when I'm done?
    The Key is displayed in the Scrollbar and below a bit to the right is the InputField for the Value.

    Currently:
    upload_2020-1-14_17-22-21.png

    How it should look like:
    upload_2020-1-14_17-27-48.png

    As I'm new to the EditorScripting I have no Idea where I should start and what I can do.
    If someone can Help me, even with Small Steps like one of the Following, I would be happy:
    - How to Add Stuff into a Scrollbar
    - How to create thoose Boxes


    Thx,
    RPGFabi
     
    Last edited: Jan 14, 2020
  2. RPGFabi

    RPGFabi

    Joined:
    Oct 24, 2019
    Posts:
    29
    Done, This is the solution

    Code (CSharp):
    1.  scrollPos = GUILayout.BeginScrollView(scrollPos, false, true);
    2.                 GUILayout.Label("Localization Keys from Files", GUILayout.Height(50) );
    3.                 for (int i = 0; i < localizationData.items.Length; i++)
    4.                 {
    5.                     EditorGUILayout.BeginFoldoutHeaderGroup(true, localizationData.items[i].key);
    6.                    
    7.                     EditorGUI.indentLevel++;
    8.                             EditorGUILayout.BeginHorizontal();
    9.                                 EditorGUILayout.LabelField("Value to set: ", GUILayout.Height(20));
    10.                                 localizationData.items[i].value = EditorGUILayout.TextField(localizationData.items[i].value, GUILayout.Height(20));
    11.                                 GUILayout.FlexibleSpace();
    12.                             EditorGUILayout.EndHorizontal();
    13.                     EditorGUI.indentLevel--;
    14.                    
    15.                     EditorGUILayout.EndFoldoutHeaderGroup();
    16.                 }
    17.             GUILayout.EndScrollView();