Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using CurvedVRKeyboard;
- using UnityEngine;
- using UnityEngine.UI;
- public class ChangeScript : MonoBehaviour {
- public GameObject[] outputs; // outputs I want to interact with
- public KeyboardStatus kStatus; //keyboard Status script
- int selected = 0;
- void Start () {
- //select first output as current to write
- kStatus.targetGameObject = outputs[selected];
- }
- // Update is called once per frame
- void Update () {
- if(Input.GetKeyDown(KeyCode.RightArrow)) {//if i press right arrow
- //select next output as current
- selected = ( selected + 1 ) % outputs.Length;
- kStatus.targetGameObject = outputs[selected];
- //kStatus.output is current string value all key press will be appended to.
- //It does not change when we change output, so we have to set it by ourself according to current output value
- kStatus.output = outputs[selected].GetComponent<Text>().text;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement