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

ScrollView positioning

Discussion in 'Scripting' started by TS1997, Jan 5, 2015.

  1. TS1997

    TS1997

    Joined:
    Sep 6, 2014
    Posts:
    18
    Hello!

    I'm currently working on a multiplayer FPS game using Unity3D 4.5 and CSharp. I have a chat window that I use a scrollview for but no matter what values I enter it always place itself in the top left corner but I want it in the bottom left corner right above the textfield.

    Here's the coe I currently have for the window:
    Code (CSharp):
    1. Vector2 v = new Vector2(0, (Screen.height / 2) - (Screen.height / 8));
    2. v = GUILayout.BeginScrollView(v, "box", GUILayout.Width(Screen.width / 3), GUILayout.Height(Screen.height / 4));
    And the textfield:
    Code (CSharp):
    1. InputString = GUI.TextField(new Rect(0, (Screen.height) - (Screen.height / 16), Screen.width / 3, Screen.height / 16), InputString);
    Any help is appreciated!

    Thanks in advance
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
  3. TS1997

    TS1997

    Joined:
    Sep 6, 2014
    Posts:
    18
    Thanks for the quick answer!

    How do I do that if I want a scrollable window as a chat window? Could you give me a small example? I want a textfield in the bottom left corner and right above that I want the scrollable chatwindow.

    Thanks in advance