Activate GUI.TextField on controller Button Press

mabitmabit Posts: 12Member
I have a player name entry which at present uses the Trakpad to allow players to click to change name. How can this be activated on Button press in case players are using an non Ouya controller?


Comments

  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    You could make a FocusManager that keeps track of your UI layout so it knows where the focus is. I use something like this.

            public class ButtonMapping
            {
                public ButtonSprite Up = null;
                public ButtonSprite Left = null;
                public ButtonSprite Right = null;
                public ButtonSprite Down = null;
            }

    And then a Dictionary to map UI elements so that when you press the dpad, it knows which element to go to next.

                m_focusManager.Mappings[BtnPause] = new FocusManager.ButtonMapping()
                {
                    Right = Btn480,
                };

                m_focusManager.Mappings[Btn480] = new FocusManager.ButtonMapping()
                {
                    Right = Btn720,
                };

                m_focusManager.Mappings[Btn720] = new FocusManager.ButtonMapping()
                {
                    Left = Btn480,
                    Right = Btn1080,
                };

                m_focusManager.Mappings[Btn1080] = new FocusManager.ButtonMapping()
                {
                    Left = Btn720,
                };
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • AyrikAyrik Posts: 429Member
    edited July 2013
    You're probably looking for this: http://docs.unity3d.com/Documentation/ScriptReference/GUI.FocusControl.html.

    I'm not sure if it works for popping up the keyboard, but I'm pretty sure that's what it's for.
    Post edited by Ayrik on
    Saga Heroes - Adventure RPG
    image image
  • mabitmabit Posts: 12Member
    Thanks for the suggestions, Ayrik I looked at that. I was hoping there was going to be some simple solution I had overlooked.

    Went for simplest option in end. Every OUYA owner has at least one controller, to has a trackpad. :)
  • Killa_MaakiKilla_Maaki Posts: 504Member
    mabit said:
    Thanks for the suggestions, Ayrik I looked at that. I was hoping there was going to be some simple solution I had overlooked.

    Went for simplest option in end. Every OUYA owner has at least one controller, to has a trackpad. :)
    I've tried trackpad navigation. Your "simple option" is going to get you a LOT of flak. It's very difficult and unwieldy to navigate a console game with a laptop trackpad.

    I would instead suggest coding your own custom "textfield" for the OUYA version. It's very easy - instead of a textfield, use a button. When the button is clicked, display the keyboard.
    You didn't remember the plot of the Doctor Who movie because there was none; Just a bunch of plot holes strung together.
Sign In or Register to comment.