- Home /
Question by
TSCSimulation_AH · Nov 26, 2018 at 12:02 PM ·
c#uiinputcontrollerinputfield
Hover Over Input Field Before Inputting?
Hi guys,
I have an Input Field and I want to input stuff into. Problem is, whenever I move over it with the controller, it auto-selects and I can't move off it after.
I want to have a mode where I can move over it and to the buttons below and above, but only when I press the A button does it lock me into that field and allow me to use it, then when I press B it deselects and I can continue navigating the menu.
Thanks!!
Comment
Best Answer
Answer by TSCSimulation_AH · Nov 26, 2018 at 12:15 PM
Done. I just needed to use the ActivateInputField() and DeactivateInputField() methods on A and B button presses.
Answer by Bujju · Dec 02, 2018 at 08:05 PM
i don't exactly know how to do this but here is a similar script I just wrote
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Quitting : MonoBehaviour {
public Text QuitText;
private string QuitString = "Quitting";
void Update()
{
if (Input.GetKey("escape"))
{
StartCoroutine("WaitBeforeQuit");
QuitText.text = "QUITTING";
}
}
public IEnumerator WaitBeforeQuit()
{
yield return new WaitForSeconds(10);
if (Input.GetKey("escape"))
{
Debug.Log("Quit");
Application.Quit();
}
else
{
QuitText.text = "";
}
}
}