Why cant I scroll Horizontally in GUI.BeginScrollArea when i set GUIStyle params to null ?

Here is an example

I want my scroll area without any scrollbars . Unity gives us this option.

However when I implement it . I can only scroll virtically with my trackpad or graphics tablet … but I cant scroll horizontally
here :

public Vector2 ScrollView;

void OnGUI()
{
 ScrollView = GUI.BeginScrollView(new Rect(0, 0,300,100), ScrollView, new Rect(0, 0, 900,100), GUIStyle.none, GUIStyle.none);

//I can still scroll birtically
//but
// I cant scroll Horizontally here  

GUI.EndScrollView();

}

1 Answer

1

I usually use the inspector for creating GUI elements. Could this be your issue?

GameObject → Scrol Rect (Script) → Checking vertical but unchecking horizontal allows you to only scroll vertically. Checking both allows scrolling in both directions.

53465-screen-shot-2015-09-04-at-65247-pm.png

I am working in OnGUI() I'm not using UnityEngine.UI