public class OuyaShowUnityInput
{
void Update()
{
if (OuyaExampleCommon.GetButton(OuyaSDK.KeyEnum.BUTTON_L3, OuyaExampleCommon.Player))
{
//button is pressed
}
else
{
//button is not pressed
}
}
}
to call Application.LoadLevel in a scene.
But if that loaded scene contains a similar if statement in Update it fires in the new scene too even if the button isn't pressed. I'm pressing and releasing the button as quickly as possible, I don't think its a "GetButton" vice "GetButtonDown" thing but I don't know. This doesn't happen in the Unity IDE, only on the Ouya device. In my vanilla project I have an init scene, a main scene and a second scene. Init initializes OuyaGameObject and loads main. Main waits for the controller "O" button to be pressed and loads second scene. Second scene has a bool member "oPressed" that is set to true if the controller "O" button is pressed, GUI.Label shows state of "oPressed". In Unity IDE oPressed stays at false, in Ouya device it is set to true. Am I the only one having this problem? A forum and Google search turned up nothing. Any help would be greatly appreciated.
Code from the project:
The Init Scene -
using UnityEngine;
using System.Collections;
public class ControllerTestInit : MonoBehaviour
{
void Update ()
{
Application.LoadLevel("ControllerTestMainMenu");
}
void OnGUI()
{
GUI.Label(new Rect(128, 128, 128, 32), "Initializing...");
}
}
The Main Scene -
using UnityEngine;
using System.Collections;
public class ControllerTestMainMenu : MonoBehaviour
{
void Update()
{
if (OuyaExampleCommon.GetButton(OuyaSDK.KeyEnum.BUTTON_O, OuyaExampleCommon.Player))
{
Application.LoadLevel("ControllerTestSecondScene");
}
}
void FixedUpdate()
{
OuyaExampleCommon.UpdateJoysticks();
}
void OnGUI()
{
GUI.Label(new Rect(128, 128, 512, 64),
@"Main menu - Press the ""O"" button to go to Second Scene");
}
}
The Second Scene -
using UnityEngine;
using System.Collections;
public class ControllerTestSecondScene : MonoBehaviour
{
bool oPressed;
void Start()
{
oPressed = false;
}
void Update()
{
if (OuyaExampleCommon.GetButton(OuyaSDK.KeyEnum.BUTTON_O, OuyaExampleCommon.Player))
{
oPressed = true;
}
if (OuyaExampleCommon.GetButton(OuyaSDK.KeyEnum.BUTTON_A, OuyaExampleCommon.Player))
{
Application.LoadLevel("ControllerTestMainMenu");
}
}
void FixedUpdate()
{
OuyaExampleCommon.UpdateJoysticks();
}
void OnGUI()
{
GUI.Label(new Rect(128, 128, 512, 64), @"Second Scene - Press the ""A"" button to go to Main menu" + "\noPressed: " + oPressed.ToString()); }
}
Comments
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].
to all the scenes in my test project and the problem remains.
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].
to the OuyaGameObject class thinking that since it's the only persistent object that may ensure the reset happens even though the Awake/Destroys should handle it. Still no joy.
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].
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].
That would be swell.
I added:
public static bool GetButtonDown(int buttonNum, OuyaSDK.OuyaPlayer player)