public void RemoveParameter() { if (eventParams == null || eventParams.Count == 0) { return; } int oldIdx = eventParams.Count - 1; CustomEventParamEntry oldEntry = eventParams[oldIdx]; // cleanup eventParams.RemoveAt(oldIdx); GameObject.Destroy(oldEntry.gameObject); // show hide buttons _AddParamButton.gameObject.SetActive(eventParams.Count < MAX_PARAMETERS); _RemoveParamButton.gameObject.SetActive(eventParams.Count > 0); }
public void AddParameter() { if (eventParams == null) { eventParams = new List <CustomEventParamEntry>(); } if (eventParams.Count >= MAX_PARAMETERS) { return; } CustomEventParamEntry newEntry = CustomEventParamEntry.Instantiate(_ParameterEntryPrefab); newEntry.transform.SetParent(_ParameterList); newEntry.transform.SetSiblingIndex(0); newEntry.transform.localScale = Vector3.one; eventParams.Add(newEntry); // show / hide buttons _AddParamButton.gameObject.SetActive(eventParams.Count < MAX_PARAMETERS); _RemoveParamButton.gameObject.SetActive(eventParams.Count > 0); }