Search Unity

this week Live Training - Mobile Development

Discussion in 'Android' started by frigorifico, Mar 14, 2014.

  1. frigorifico

    frigorifico

    Joined:
    Sep 5, 2013
    Posts:
    37
    hi every one,

    i was watching this week Training video and i have a doubt.

    Mike Geig say in the video "do not use OnGUI for mobile development, just dont" and "i make my own OnGUI".

    the thing is, he didnt explain wy we shouldn't use OnGUI, and he all so didnt explain what to use instead of OnGUI.

    if any one can explain this two topics i whould really appreciate it.

    thx in advance

    HTML:
    http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/mobile-development
     
    Last edited: Mar 14, 2014
  2. mikhail111777

    mikhail111777

    Joined:
    Feb 8, 2013
    Posts:
    84
    The OnGUI() way uses 1-2 draw calls per control.

    Use 2D Toolkit, NGUI or Unity Sprites instead of OnGUI()
     
  3. MDragon

    MDragon

    Joined:
    Dec 26, 2013
    Posts:
    329
    Just to piggy back off of this, how does GUIText relate? Currently using sprites+box colliders+ a custom input parsing script to control all GUIs so far, but I have to make the score display something in the near future (still early development). How would a GUIText for a score display (with a custom bitmap for the text) compare to OnGUI and sprites (the latter of which would be harder to implement)?
     
  4. frigorifico

    frigorifico

    Joined:
    Sep 5, 2013
    Posts:
    37
    i am sry mikhail111777 but i can not accept that the solution is to go and spend 65$ in the asset store buying a plugin

    and that 10 or 20 game objects(quads)+box colliders+ input are easier on the GPU/CPU of the mobile device that lets say 10 or 20 draw calls.

    plz correct me if i am wrong
     
  5. mikhail111777

    mikhail111777

    Joined:
    Feb 8, 2013
    Posts:
    84
    Don't accept it, if you can't, noone is going to force you.

    And yes, you are wrong, 100 game objects is better than 10 draw calls on Android. And it has been discussed so many times that you can easily Google it.
     
  6. MDragon

    MDragon

    Joined:
    Dec 26, 2013
    Posts:
    329
    And you don't have to go to the asset store EVER to buy anything. You can always create it yourself. It's always a matter of what your time is worth.

    Also, those gameobjects are QUITE simple as well: just a simple sprite with a certain layer put on it. And my input script also practically adds no more overhead (if any) to, say, a mobile GUI utilizing OnGUI(), OnMouseButton(), OnMosueHover(), etc.
     
  7. frigorifico

    frigorifico

    Joined:
    Sep 5, 2013
    Posts:
    37
    ok guys, i will try and follow ur advice, and plz dont think im trying to be a smart ass, im just a noob whit no money :p

    i will google a bit more.

    thx for the help

    ps: let me see if i got this right, every time i do GUI. its a draw call
     
    Last edited: Mar 15, 2014
  8. pixelmechanic

    pixelmechanic

    Joined:
    Jan 8, 2014
    Posts:
    10
    And there is another reason for not using OnGUI on mobile devices:

    With OnGUI Buttons you can use only one button at a time. Most mobile devices are able to handle more than one touch at the same time. With the Unity Input/Touch classes you can manage more than one button press at the same time. Most of the mobile devices can handle min. 2 touches, some devices can even handle up to 16 touches at the same time. But who cares, when you only have 10 fingers? ;)
     
  9. frigorifico

    frigorifico

    Joined:
    Sep 5, 2013
    Posts:
    37
    never thought about that. That is a very good reason to use touch input.

    all the anseres ppl added make sense and explains my doubts.

    if any one know any more reasons keap them coming plz
    the question is, wy shouldnt we use OnGUI, wy is it so heavy on mobile devices?
     
  10. m-y

    m-y

    Joined:
    Sep 22, 2013
    Posts:
    472
    Help please
    i want to add advertisements on my game
    i am using unity ( free version )
    i go every where
    but it is for pro version
    helpppp
     
  11. frigorifico

    frigorifico

    Joined:
    Sep 5, 2013
    Posts:
    37
    hi again,

    so i went online and googled a bit more, and there are several tutorial on the topic input.touch for mobile, but all most all of them uses guitextures to place the game object. each guitexture is 1 drawcall + 13 tris, a gui.button its with no text its the same 1 drawcall and 13 tris if i use a gui.button its with text then its 2 drawcalls and 24 tris.

    so i ask again is the OnGUI so bad? and the anser i know its going to be yes it is... "try not to use the ongui in mobile". but the anser is not the use of guitextures, can some one plz point in the correct direction. is the trick to use quads or sprites or an other type of game object? i had some luck with sprites is this the way?

    thx guys
     
    Last edited: Mar 19, 2014