// Use this for initialization void Start() { buttonCount = 0; buttonHeight = roomButtonPrefab.GetComponent <RectTransform> () .rect.height; // For debugging AddButton("hello"); AddButton("hello"); AddButton("hello"); }
/** * Instantiate a button and */ private void AddButton(string text) { RoomButton button = Instantiate <RoomButton> (roomButtonPrefab); button.transform.SetParent(transform); // Set where the button is and the text it displays SetButtonPos(button.GetComponent <RectTransform> ()); buttonCount += 1; SetButtonText(button, text); button.AddAction(OnRoomButtonPressed); }
public void MoveToRoomPanel(RoomButton roomButton) { roomButton.GetComponent <RectTransform>().SetParent(roomPanel); }