public void CreateList() { if (windowOpen) { DispensaryUIPanel dispensaryUIPanel = gameObject.GetComponent <DispensaryUIPanel>(); if (dispensaryUIPanel != null) { dispensaryUIPanel.CreateList(searchBar.GetText()); } StoreObjectUIPanel storeObjectPanel = gameObject.GetComponent <StoreObjectUIPanel>(); if (storeObjectPanel != null) { storeObjectPanel.CreateStoreObjectsList(searchBar.GetText()); } } }