void Start() { Collider col = GetComponent <Collider>(); if (!col) { col = gameObject.AddComponent <BoxCollider>(); } //Collider has to be a trigger collider if (col.isTrigger == false) { col.isTrigger = true; } manager = VRKeyboardManager.instance; mat = GetComponent <MeshRenderer>().material; //Find the displays on the key shiftDisp = transform.GetChild(0).Find("ShiftDisp").GetComponent <TextMeshProUGUI>(); mainDisp = transform.GetChild(0).Find("MainDisp").GetComponent <TextMeshProUGUI>(); if (!shiftDisp || !mainDisp) { Debug.LogError(gameObject.name + " could not find the displays for it's key. Please ensure the displays are present and are called ShiftDisp and MainDisp"); } currentColour = manager.unPressedColour; colourLerpSpeed = manager.colourLerpSpeed; }
private void Awake() { if (instance == null) { instance = this; } }