Alternative to GUI Scrollview ?

Hi guys,

I want to know if there is any other choices to create a scroll view aside from GUI Scrollview. The problem with GUI elements was that they displayed differently coordinates and size-wise between Unity and actual devices, which made my development process difficult. So, any suggestions ? Thanks a lot in advance !

Hi, you can create a GUI group, render everything inside it, and when “scrolling” just move GUI group y. What comes to screen independence, it’s tricky, mostly you should use percentage instead of actual pixels, because or retina screens. You could use matrix, but its tends to stretch things…

//Button which is 10% from horizontal sides
private int screenXp;
private Rect rect_button;

private void Start(){
    screenXp = Screen.width/100;
    rect_button = new Rect(screenXp * 10,
                           0,
                           Screen.width - screenXp * 20,
                           Screen.height);
}

private void OnGUI(){
    GUI.Button(rect_button, ""); //same button on all devices, by not considering the ratio
}