Author Topic: GUILayout.BeginScrollView  (Read 3824 times)

Argento21

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
GUILayout.BeginScrollView
« on: February 13, 2014, 05:59:33 AM »
I'm trying ngui and honestly I have no idea how to convert this code to be acceptable in Ngui (especially the part of scrollview):

  1. GUILayout.BeginArea(new Rect((Screen.width - 400) / 2, (Screen.height + 95) / 2, 400, 100));
  2. GUILayout.BeginHorizontal();
  3.  
  4. this.scrollPos = GUILayout.BeginScrollView(this.scrollPos);
  5. foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList())
  6. {
  7.         GUILayout.BeginHorizontal();
  8.         GUILayout.Label(roomInfo.name + " " + roomInfo.playerCount + "/" + roomInfo.maxPlayers);
  9.                                
  10.         if (GUILayout.Button("Join"))
  11.         {
  12.                 PhotonNetwork.playerName = nameInput.GetComponent<UIInput>().value; /* here i'm actually usgin NGUI :-X */
  13.                 PhotonNetwork.JoinRoom(roomInfo.name);
  14.         }
  15.                        
  16.         GUILayout.EndHorizontal();
  17. }
  18.                        
  19. GUILayout.EndScrollView();
  20. GUILayout.EndHorizontal();
  21. GUILayout.EndArea();

PS: Sorry if I did't express myself well, i'm using a translator  :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: GUILayout.BeginScrollView
« Reply #1 on: February 14, 2014, 05:58:21 AM »
You can't convert OnGUI code to NGUI. They are inherently different systems that have nothing in common with each other other than the word "GUI".

I strongly advise starting with the NGUI 3.0.7 tutorial video and going from there. And pretty much forget everything you've learned about OnGUI as it will only hinder you when working with NGUI.