public void InitKeys() { if (keys == null || KeyboardItem.forceInit) { List <KeyboardItem> allKeys = new List <KeyboardItem>(GetComponentsInChildren <KeyboardItem>()); for (int i = 0; i < allKeys.Count; i++) { allKeys[i].Position = i; allKeys[i].Init(); } space = allKeys[spaceKeyNumber]; keys = allKeys.ToArray(); } space.ManipulateSpace(this, SpaceSprite); }
/// <summary> /// When spacebar material is set it is created as a new material so the reference /// to buttons' material is lost and changing them do not affect spacebar. /// User has to manualy reload material if he changed them in editor /// </summary> public void ReloadSpaceMaterials() { space.SetMaterials(KeyNormalMaterial, KeySelectedMaterial, KeyPressedMaterial); space.ManipulateSpace(this, SpaceSprite); }