- Home /
Unity OnGUI
Hi,anybody,I think in your games,you should not have used OnGUI for your ui system (may ezGUI or the another),but I used or our team used,So we can only ge ahead by this way.Then something terrible comes to me :(.I want to display a large world map with a windows and it's too large so that the windows cannot display it very well.So what I would do is that drawing a part of the map and drag the map to show the other parts of it.I had a try with ScrollView and it acted well.But scrollview dont support the draging,I am limited to use scrollbar to control the field view of the map(that is not we want).So if OnGUI within unity3d can provide what I have said.Sorry for my poor english,and if anybody can understand what I mean,please give me a hand.I will appreciate you help.Thx again:)
Answer by whydoidoit · Jul 05, 2012 at 04:20 AM
You could just implement the map yourself by processing the events that happen in the OnGUI code. Check out this reference. Look for Event.current.type == EventType.MouseDown, store the position, work out the deltas in the subsequent events and move where you draw the map.
aha,wonderful,that's what I need.Just now,Input.getmouse comes into my $$anonymous$$d,but I think what you said is better.because I really dont like to putting my input code into GUI,althouth they are similar.Thx again!
actually Input.mousePosition works in side OnGUI() too but should prefer using Event.current.mousePosition.
also event is much powerful compared to Input (in this case).
Yeah - but Get$$anonymous$$ouseDown doesn't right - at least it didn't when I accidentally tried it.
oh may be but i tried Input.mousePosition, it worked ... strange unity
Your answer
![](https://koobas.hobune.stream/wayback/20220613073728im_/https://answers.unity.com/themes/thub/images/avi.jpg)