void PopulateFrom(IEnumerable <InputAction> actionEnumerator, int categoryDisplayMask) { int index = 0; foreach (var inputAction in actionEnumerator) { if (inputAction.properties.hiddenInLists && !disablePropertyRestrictions) { continue; } // Not displaying these actions at the moment. if (((1 << inputAction.properties.category) & categoryDisplayMask) == 0) { continue; } if (index >= rowPool.Count) { ExtendActionRowPool(20); } ActionUIRow row = rowPool[index++]; row.SetupFromAction(inputAction, actionEnumerator, lastKnownDisplayDevice, InvokeRebindState, disablePropertyRestrictions); row.SetActive(true); } for (int i = index; i < rowPool.Count; ++i) { ActionUIRow row = rowPool[i]; row.SetActive(false); } UpdateRowLayout(); }
void ExtendActionRowPool(int extendBy) { Transform parent = transform; for (int i = 0; i < extendBy; ++i) { bool isActive = false; ActionUIRow row = new ActionUIRow(); row.actionNameText = GameObject.Instantiate(actionNamePrefab, parent); for (int j = 0; j < row.actionInputButtons.Length; ++j) { row.actionInputButtons[j] = GameObject.Instantiate(actionInputPrefab, parent); } row.SetActive(isActive); rowPool.Add(row); } }