Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1.  
  2. using CurvedVRKeyboard;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class ChangeScript : MonoBehaviour {
  7.     public GameObject[] outputs; // outputs I want to interact with
  8.     public KeyboardStatus kStatus; //keyboard Status script
  9.  
  10.     int selected = 0;
  11.  
  12.     void Start () {
  13.         //select first output as current to write
  14.         kStatus.targetGameObject = outputs[selected];
  15.     }
  16.  
  17.     // Update is called once per frame
  18.     void Update () {
  19.         if(Input.GetKeyDown(KeyCode.RightArrow)) {//if i press right arrow
  20.  
  21.             //select next output as current
  22.             selected = ( selected + 1 ) % outputs.Length;
  23.             kStatus.targetGameObject = outputs[selected];
  24.  
  25.             //kStatus.output is current string value all key press will be appended to.
  26.             //It does not change when we change output, so we have to set it by ourself according to current output value
  27.             kStatus.output = outputs[selected].GetComponent<Text>().text;
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement